captuting mouse position.
-
hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta
-
hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta
in your
OnMouseUp
event of your control, add the following code:MessageBox.Show("X: " + Cursor.Position.X + ", Y: " + Cursor.Position.Y);
You can use theCursor.Position
property to find the current location of your mouse cursor on the screen. Jon G www.Gizmocoder.com -
hai all :-O, i am creating a c# application where i have a panel and on top of that i have an user control. when i click the usercontrol at any position, i need to capture the exact mouse position on the panel. Sweta
After retrieval of the mouse position as described by the preceding posting use the PointToClient method of your Panel to convert the mouse position from screen coordinates into client coordinates of your Panel.