我有一个Panel
,其中包含任意数量的子控件:
如果鼠标进入Panel
中的子控件之一:
然后 Panel
的 MouseEnter
事件不会被触发。
Note: A related problem is that if the mouse moves from the the panel to one of the child controls, then the Panel's
MouseLeave
event is fired:Even though the mouse did not leave the panel.
如果鼠标进入面板上的子控件“任何”,如何触发 Panel
的 MouseEnter
事件?
最佳答案
类似于:
foreach (Control ctrl in panel1.Controls)
ctrl.MouseEnter += panel1_MouseEnter;
关于WinForms:当鼠标进入控件时如何使MouseEnter触发?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8172535/