WinForms: How to get MouseEnter to start when the mouse enters the control?

i has a Panel that contains an arbitrary number of child controls:

enter image description here

If the mouse enters one of the child controls in the Panel :

enter image description here

Then the MouseEnter Panel event MouseEnter not MouseEnter .

Note. . A related issue is that if the mouse moves from the panel to one of the child controls , then the MouseLeave panel:

enter image description here

Even if the mouse did not leave the panel.

How can I raise the MouseEnter event for the Panel to fire if the mouse enters "any" control that is a child of the panel?

+2
source share
1 answer

Sort of:

 foreach (Control ctrl in panel1.Controls) ctrl.MouseEnter += panel1_MouseEnter; 
+4
source

Source: https://habr.com/ru/post/1237796/


All Articles