且构网

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

多个按钮一个控制变量

更新时间:2023-12-06 12:51:04

使用发送方对象来确定按下了哪个按钮.

在您的OnClickEvent状态下:
use the sender object to determine which button was pressed.

in your OnClickEvent state:
Button clickedOne = (Button) sender;



现在,您可以访问按钮的ID或Text属性,并执行您想做的事情



You can now access ID or Text properties of the button and do what you want to do