首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

按钮有关问题(续)

2012-03-12 
按钮问题(续)Button b (Button)senderb.Text 完成实现了 单击按钮 改变按钮名字。如何实现按其他按

按钮问题(续)
Button b = (Button)sender;
  b.Text = "完成";
实现了 单击按钮 改变按钮名字。
如何实现按其他按钮时候该按钮返回原来的显示值
比如Button1原显示值为 “OK” 单击后显示为 “完成”再单击其他按钮Buttonx时 Button1显示值又返回为“OK”


[解决办法]
在其他Buttonx的Click事件里写
 button1.text="OK";
[解决办法]
另一个button click事件里
button1.text = "OK";

[解决办法]
Button b = (Button)sender; 
if( b.Text == "完成")
b.Text = "OK";
else
b.Text = "完成";

热点排行