danych

hello all, how can i get the position of a cursor on a form.

using the cursor.position returns the cordinates according to the whole screen

10x




Re: Visual C# Language mouse cursor position

RizwanSharp

Hook an event handler with MouseMove of Form and see whats coming in MouseEventArgs like this:

private void SomeForm_MouseMove(object sender, MouseEventArgs e)
{
Point mousePosition = e.Location.X;
}

I hope this will help.

Best Regards,

Rizwan aka RizwanSharp






Re: Visual C# Language mouse cursor position

BlueMikey

Actually, there is a better way to do it without having to deal with handling an event, in case you only want to find out on demand:

Point loc = myForm.PointToClient(Cursor.Position)

And that works for every control.




Re: Visual C# Language mouse cursor position

danych

Thank you man that was very helpfull