C# MouseEnter-Event for the whole window

c#, mouseenter

Solution

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
            }
        }

Problem

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.

Original source

Related problems