Welcome to WindowsClient.net | Sign in | Join

Bassl Kokash

.NET Framework Developer - MCSE

Sponsors





  • advertise here

News

Intrgration - Extensionability - Solution

Mouse Coordinates in Form

one of the easiest way to get the mouse coordinates on the form is by using an ready attribute ,this attrbute is on the Control Class ,MousePosition and here you will get and x and y Coordinates for the mouse just in the moment of the running the application , so to get this coordinates dynamically you can bind this with MouseMove event for the form which you want to get mouse movment like this :

private void Form1_MouseMove(object sender, MouseEventArgs e)

{

label5.Text =
"X : " + Control.MousePosition.X.ToString();

label6.Text = "Y : " + Control.MousePosition.Y.ToString();

this.Refresh();

}

 

I hope thats help

Comments

BasharKokash said:

Nice job, but what if the mouse get out of the form you will not know the cordinates!

# February 11, 2008 2:40 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Page view counter