Is it possible to create a MouseEnter-Event also for the border of the window? I mean also for the minimize and maximize-buttons. Because if I set the Event for my Form1, it works only when i'm inside the Form, but not on the border and the Buttons.
Asked
Active
Viewed 881 times
3
-
Here http://stackoverflow.com/questions/3312752/capturing-mouse-keyboard-events-outside-of-form-app-running-in-background may be help you. – OammieR Apr 11 '12 at 09:08
1 Answers
4
You can override WndProc in you form and you can detect mousemove
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
// mouse in window or in Border and max, close & min buttons
if (m.Msg == 0xa0 || m.Msg == 0x200)
{
//Do some thing
}
}

Amen Ayach
- 4,288
- 1
- 23
- 23
-
Note: my code detect mouse move so if you want just mouse enter you can make a global variable(bool) and play around it to avoid multiple calls – Amen Ayach Apr 11 '12 at 09:23
-
1
-
@HndlCode,Yeah any event on winforms could be traced by overriding WndProc – Amen Ayach Apr 13 '12 at 06:35