事件识别 [英] identification of event

查看:89
本文介绍了事件识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我在页面和面板上有多个按钮,其中在启动面板上创建表单的表单是不可见的,当我单击面板外的任何按钮时,面板是可见的

现在,我想确定单击了哪个按钮,并希望在面板发生某些事件时更改按钮的颜色.





i have multiple buttons on a page and panel in which a form is created on that in the starting panel is invisible and when i click on any button outside the panel that panel is visible

now i want to identify which button is clicked and want to change the color of that when some event is fire from panel

推荐答案

尝试此

Button btn = sender作为Button

if(btn.id ==您的按钮ID")
{

}
try this

Button btn=sender as Button

if(btn.id=="your Button Id")
{

}


事件触发时,通常称为发送者"并传递给事件的对象是发送事件的控件.将其强制转换为按钮,然后检查ID以找出它是哪个ID.
When an event fires, the object that is typically called ''sender'' and is passed in to the event, is the control that sent the event. Cast it to button and check the id to work out which one it was.


这篇关于事件识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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