Vcl.Controls.TControl.ClientToScreen

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ClientToScreen(const Point: TPoint): TPoint; overload;
function ClientToScreen(const Rect: TRect): TRect; overload;

C++

System::Types::TPoint __fastcall ClientToScreen(const System::Types::TPoint &Point)/* overload */;
System::Types::TRect __fastcall ClientToScreen(const System::Types::TRect &Rect)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TControl

Description

Translates a given point from client area coordinates to global screen coordinates.

Use ClientToScreen to convert a point whose coordinates are expressed locally to the control to the corresponding point in screen 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.

See Also

Code Examples