Click here to Skip to main content
15,350,008 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to know when the mouse pointer is over a form, just if the mouse is over the frame or the title bar.

MouseEnter and MouseLeave events will be fired, if Mouse goes inside respectively outside the "inner area" (form1.ClientRectangle) of the Form. But I will see an event, if the mouse goes inside respectively outside the form1.DesktopBounds.
Posted
Updated 21-Nov-12 3:42am
v2

1 solution

I think you cant handle this - if the "title bar" ( i think you mean the border of the window) has focus

the frame is easy to access just use

private void Form1_MouseEnter(object sender, EventArgs e)
        {
            textBox1.Text = "asdf";
        }


or whatever should happen ;)
   
Comments
BlackMilan 21-Nov-12 9:41am
   
I think, you doesn't understand the problem behind. MouseEnter and MouseLeave events will be fired, if Mouse goes inside respectively outside the "inner area" (form1.ClientRectangle) of the Form. But I will see an event, if the mouse goes inside respectively outside the form1.DesktopBounds.
David Goebet 21-Nov-12 9:54am
   
then you have to extract the bounds of the form and then listen till your mouse cursor is in that area

and if this is still not what you wanted im totally clueless :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900