c#控件的可见属性在事件上没有变化
我有一个带有combobox的winform,带有选项是或否,这是我的事件代码:
private void cmbYesNo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cmb = sender as ComboBox;
if (cmb.Text == "Yes")
{
this.button1.Visible = true;
}
else
{
this.button1.Visible = false;
}
}
调试代码,它确实正确地进入了我想设置可见属性的正确语句,但它不会物理上对其进行更改形式。我想念什么?
I have a Winform with a combobox with the options Yes or No and this is my event code:
private void cmbYesNo_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cmb = sender as ComboBox;
if (cmb.Text == "Yes")
{
this.button1.Visible = true;
}
else
{
this.button1.Visible = false;
}
}
Debugging the code, it does correctly go into the correct statement where I am wanting to set the visible property but it doesn't physically change it on the form. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论