What is the best way to get the mouse position over a shape?

I want the best way to get the mouse position for a form.

I, m now set mouse position values ​​in variables to get them in other Like Like1_Click methods.

Is there a better way to do this?

Thank you very much.

+4
source share
2 answers
xm=System.Windows.Forms.Cursor.Position.X - this.Location.X ym=System.Windows.Forms.Cursor.Position.Y - this.Location.Y 

then you should do:

 xm - form border x ym - form border y 
0
source

All Articles