RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TControl.ScreenToClient Method

Converts the screen coordinates of a specified point on the screen to client coordinates.

Pascal
function ScreenToClient(const Point: TPoint): TPoint;
C++
__fastcall TPoint ScreenToClient(const TPoint Point);

Use ScreenToClient to convert a point in screen coordinates to local, or client area, coordinates. In client area coordinates (0, 0) corresponds to the upper left corner of the control's client area. In screen coordinates (0, 0) corresponds to the upper left corner of the screen. 

Use ScreenToClient along with ClientToScreen to convert from one control's coordinate system to another control's coordinate system. For example,

P := TargetControl.ScreenToClient(SourceControl.ClientToScreen(P));

 

P = TargetControl->ScreenToClient(SourceControl->ClientToScreen(P));

converts P from coordinates in SourceControl to coordinates in TargetControl. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!