且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Windows窗体中按钮的状态更改

更新时间:2023-12-06 16:02:16

简单的方法是不要试图将其改为点击,而是禁用或灰色而不是。

这很容易:将Button.Enabled属性设置为false以禁用它,并将true设置为重新启用它。



处理TextBox.TextChanged事件以重新启用它。
The easy way is not to look at trying to change it to "clicked", but to disabled, or"greyed" instead.
That is easy: set the Button.Enabled property to "false" to disable it, and "true" to reenable it.

Handle the TextBox.TextChanged Event to reenable it.


使用 WebControl.Enabled [ ^ ]属性。此处列出了所有按钮属性: http://msdn.microsoft.com /en-us/library/system.web.ui.webcontrols.button_properties.aspx [ ^ ]



Use WebControl.Enabled[^] property. All buttons properties are listed here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button_properties.aspx[^]

Button1.Enable = (TextBox1.Text.Length>0);







Windows.Controls.Button Class [ ^ ]

Windows.Controls.Button属性 [ ^ ]

[/ EDIT]




Windows.Controls.Button Class[^]
Windows.Controls.Button properties[^]
[/EDIT]