Archived

This topic is now archived and is closed to further replies.

Get mouse pos on TPaintBox

This topic is 5316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there,

if you dont want to use a MouseMove event you could use the following

procedure TForm1.Timer1Timer(Sender: TObject);
var
p: TPoint;
begin
//get the position of the cursor on the screen
GetCursorPos(p);
//convert to controls coordinates
p := PaintBox1.ScreenToClient(p);
//output
Caption := Format(''x %d : y %d'',[p.X,p.Y]);
end;

Mark

Share this post


Link to post
Share on other sites