Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get cursor position on the form?

I need to get cursor position on the form, how would I do that?

like image 669
Little Helper Avatar asked Apr 20 '11 05:04

Little Helper


1 Answers

Pass Mouse.CursorPos to TForm.ScreenToClient().

Mouse.CursorPos is returned in the screen coordinate system. TForm.ScreenToClient() converts points into the form's client coordinate system.

In fact all TControl descendants offer the ScreenToClient() method, and its inverse, ClientToScreen(), to convert between coordinate systems.

like image 118
David Heffernan Avatar answered Oct 01 '22 14:10

David Heffernan