标签数组的事件句柄 [英] Event handle for array of labels
本文介绍了标签数组的事件句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Windows窗体中,我有一系列标签。这些在整个计划中处于不同的位置。此外,没有指定的金额 - 它们是在运行时创建的,金额取决于用户点击的内容。
我有一个鼠标悬停事件,他们都链接到。但是,我不知道如何找出鼠标悬停在哪个标签上。你能以某种方式访问哪个控件发送事件?
我试过发件人 - >但没有任何结果我可以看到... ...
非常感谢。
In windows forms, I have an array of labels. These are in different positions throughout the program. Furthermore, there is not a specified amount - they are created during run time, with the amount depending on what the user clicks.
I have a mouse hover event, which they all link to. However, I dont know how to find out which label the mouse is hovering over. Can you somehow access which control is sending the event?
I tried sender-> but nothing comes up I can see a use for...
Many thanks.
推荐答案
Cast将sender参数转换为Control,它将为您提供使用控件的所有方法和属性的可能性。
Cast the "sender" argument into a Control and that will give you the possiblity of using all the methods and properties of a control.
Control ctrl = (Control) sender;
这篇关于标签数组的事件句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文