如何使所有用户控制addhandler到事件 [英] How to make all user control addhandler to an event
问题描述
你好
我目前正在做一个项目
我必须自己选择我们自己的侧边菜单栏
当我点击侧面菜单栏按钮
侧边菜单栏出现
现在我想征求意见
是我设置鼠标点击事件的可能性,如果我按下侧面菜单旁边的表单中的所有使用控件。
then菜单栏将处理..
我尝试过:
到目前为止,我在mainForm活动中设置了一个mouseClick事件
addhandler mainForm.mouseClick,地址 _mfmClicked
private sub _mfmClicked( byval sender as object , byval e as eventargs)
dim sideBar as sidebar
sideBar.disposeSidebar()
end sub
当我点击表单时,sideBar实际上处理和隐藏
但是当我点击按钮,图片框等其他对象时
它实际上不起作用(我没有将事件处理设置为其他对象)
只需要一个建议
谢谢
这是一篇MSDN文章,向您展示< ahrehttps://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection(v = vs.110).aspx>如何使用Controls集合访问控件[ ^ ]
...这也可能有所帮助: Winform ControlCollection Extensions
[ ^ ]
hello
I am currently doing on a project
I have to custome our own side menu bar
when i click on the side menu bar button
the side menu bar appear
now i would like to ask for opinion
is that possible i set an event of mouseclick, if i press on all of the use controls in my form besides the side menu.
then the menu bar will dispose..
What I have tried:
so far i have set an event of mouseClick at the mainForm Events
addhandler mainForm.mouseClick, address of _mfmClicked
private sub _mfmClicked(byval sender as object, byval e as eventargs)
dim sideBar as sidebar
sideBar.disposeSidebar()
end sub
when i click on the form, the sideBar actually dispose and hidden
but when i click on other objects like button, picturebox and etc
it actually don't works ( i did not set the event hander to other object yet)
just need an advice
Thank you
Here is a MSDN article that shows you <a hrehttps://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection(v=vs.110).aspx">How to Access Controls by using the Controls Collection[^]
...and this may help too: Winform ControlCollection Extensions
[^]
这篇关于如何使所有用户控制addhandler到事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!