Delphi: Retrieve X/Y Position of a Control relative to the Screen
Tip by Delphian | 2013-04-03 at 03:44
Today, I would like to show you a way of how to get the X/Y coordinates of a control relative to the screen coordinates (and not to the coordinate system of the form).
In the example, we are retrieving the position of a TPanel named Panel1, but you can also use any other control:
var P: TPoint; begin P:=Panel1.ClientToScreen(Point(0,0)); Form1.Caption:=inttostr(P.X)+' '+inttostr(P.Y)); end;
This retrieves the upper left position of the Panel relative to the screen and writes the position into the caption of Form1.
About the Author
The author has not added a profile short description yet.
Show Profile
Related Topics
Mouseover buttons using CSS without reloading
Tutorial | 0 Comments
Lazarus: Match FormDropFiles with a specific ListView
Tutorial | 0 Comments
Delphi: Event Order of a Form - From OnCreate to OnDestroy
Info | 1 Comment
Delphi/Lazarus: Display Text of long ListBox Items as Hint
Tutorial | 0 Comments
Delphi/Lazarus: Retrieve Cursor Position relative to Form/Window
Tip | 0 Comments
HTML5 Canvas: Beginner Tutorial Chapter 4 - Write Text on Canvas
Tutorial | 0 Comments
Delphi: System-Wide HotKey
Tutorial | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.