Windows窗体中按钮的状态更改 [英] A button's state change in Windows forms

查看:73
本文介绍了Windows窗体中按钮的状态更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i我问一个问题请帮帮我。

如何更改按钮状态button_click to button_clicked。

i want确切地说,如果我按下提交按钮一次然后它会移动到禁用状态并且无法工作,直到我点击取消按钮或文本框中更改的文本。

i希望您了解问题。

Thanx给大家。


i am asking a question please help me.
how can i change state of a button button_click to button_clicked.
i want exactly that if i hit submit button once then it moves to disable state and not work until i hit the cancel button or text changed in textbox.
i hope you understand the problem.
Thanx to all of you.

推荐答案

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

这很容易:将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]


这篇关于Windows窗体中按钮的状态更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆