开发者

Object sender to control sender?

Is there a way for me to change object s开发者_JS百科ender into, say, control sender? What I want in the end is for object sender to tell me the controller count (controller 15, for instance), rather then it tell me "system.project.label, text : 'text here'".

I do have a way around this issue by looking through each controller on a sheet and matching object sender to said controller, but that is a fairly lengthy workaround. I'm curious if anyone knows a way to get sender to report it's control location instead.


Assuming you are talking about the object sender argument of an event handler, then you can always cast it to a control.

if(sender is Control)
{
   var myControl = sender as Control;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜