Search code examples
c#winformsvisual-studiocustom-controlsmouseenter

C# MouseEnter event activating even if something is in front of it?


I am making a custom button (Windows Forms) in Visual Studio. When I hover over the button, it triggers the mouseenter event like it should, but when I hover over the text, it triggers the mouseleave event when it is still over the button. How would I get around this?


Solution

  • The text you are talking about, is it the text of the button or some other text control? If its of the button then you should not face the problem. If its another control just add mouse hover event to it and call the same function as you were calling in mouse hover event of the button.