Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


Converts absolute screen coordinates into client-relative coordinates.


Source position: controls.pp line 1665

public function TControl.ScreenToClient(

  const APoint: TPoint

):TPoint; virtual;




TPoint instance with the screen coordinates converted in the method.

Function result

TPoint instance with the client-relative coordinates for the specified screen coordinates.


The APoint argument contains the screen coordinates which are converted to client-relative coordinates in the method. The X member has the horizontal coordinate, and the Y member has the vertical coordinate.

The return value is a TPoint type which contains the coordinates from APoint with the X and Y members decremented by the corresponding values found in the ClientOrigin for the control.

Remark: Accessing the ClientOrigin property raises an EInvalidOperation exception if Parent has not been assigned for the control.

ScreenToClient is used in the implementation of methods like ClientToParent, ParentToClient, and GetMousePosFromMessage. It is also used to convert mouse coordinates during drag and drop, docking, and context menu operations.

Use ScreenToControl to convert absolute screen coordinate to control-relative values.

Use ClientToScreen to convert client-relative coordinates to absolute screen coordinates. Use ControlToScreen to convert the coordinates in the control to absolute screen coordinates.

See also



The control within which the control is shown.



Screen coordinates of the Top, Left pixel (in the client area) of the control.



Converts absolute screen coordinates to control-relative coordinates.



Converts client-relative coordinates to absolute screen coordinates.



Converts control-relative coordinates to absolute screen coordinates.


CT Web help

CodeTyphon Studio