我想有一个textbox来修改自定义控件的最大值,发现最大值可以修改,但是控件显示会延后,要等下次点击事件后才能显示出来
比如我修改2,但控件还是显示4下次当我修改为4,控件才把上次赋值的2显示出来每次都是延后一次才会显示.郁闷啊
下面是我的代码
控件名是uivProgressBar1
private void OnSetValue_Click(object sender, EventArgs e)
{
uivProgressBar1.MaxValue = Convert.ToInt32(uiTextBox2.Text);
uiLabel7.AdsValue = uiTextBox2.Text;
try
{
NumPadForm dlg = new NumPadForm(
((InjectionMolding.TextBox.UITextBox)sender).AdsVarID,
((InjectionMolding.TextBox.UITextBox)sender).MaxValue,
((InjectionMolding.TextBox.UITextBox)sender).MinValue,
((InjectionMolding.TextBox.UITextBox)sender).Text
);
dlg.ShowDialog();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
比如我修改2,但控件还是显示4下次当我修改为4,控件才把上次赋值的2显示出来每次都是延后一次才会显示.郁闷啊
下面是我的代码
控件名是uivProgressBar1
private void OnSetValue_Click(object sender, EventArgs e)
{
uivProgressBar1.MaxValue = Convert.ToInt32(uiTextBox2.Text);
uiLabel7.AdsValue = uiTextBox2.Text;
try
{
NumPadForm dlg = new NumPadForm(
((InjectionMolding.TextBox.UITextBox)sender).AdsVarID,
((InjectionMolding.TextBox.UITextBox)sender).MaxValue,
((InjectionMolding.TextBox.UITextBox)sender).MinValue,
((InjectionMolding.TextBox.UITextBox)sender).Text
);
dlg.ShowDialog();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
解决方案 »
- SqlDataReader问题-在线等
- 读取文本文件有重复数据,该怎么处理?
- 用代理方法不行,非得用new
- 求如何用c#解开Android(apk)程序
- C#2.0连接sql server2000怪事!
- Crpt类的实例要将状态值返回到调它的cfrmUse界面中,如何实现
- new form(). 再用form.show()显示, 但是只能显示一个边框
- c#+sql数据可的问题
- System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())[0].ToString();?
- 如何用c#从eml文件中提取邮件附件
- 琢磨半天也没弄明白该把这个值怎么取出来
- 请问如果给一个excel区域设置单元格边框?
private uiTextBox2_TextChanged(object sender,EventArgs e)
{
OnSetValue_Click(sender,e); //
}
在designer.cs增加
this.uiTextBox2.Click += new System.EventHandler(this.OnSetValue_Click);(原有)
this.uiTextBox2.TextChanged +=new System.EventHandler(uiTextBox2_TextChanged);在程序增加
private void uiTextBox2_TextChanged(object sender, EventArgs e)
{
OnSetValue_Click(sender,e);
}这样都控件的值可以修改成功了,但键盘总是弹几次出来,我再看看
dlg.ShowDialog();
{
//这里设置最大值
}