[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TControl.ScreenToClient

Converts absolute screen coordinates into client-relative coordinates.

## Declaration

Source position: controls.pp line 1733

`public function TControl.ScreenToClient(`
`const APoint: TPoint`
`):TPoint; virtual;`

## Arguments

`APoint` |  | TPoint instance with the screen coordinates converted in the method.

## Function result

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

## Description

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

TControl.Parent |  | The control within which the control is shown.
TControl.ClientOrigin |  | Screen coordinates of the Top, Left pixel (in the client area) of the control.
TControl.ScreenToControl |  | Converts absolute screen coordinates to control-relative coordinates.
TControl.ClientToScreen |  | Converts client-relative coordinates to absolute screen coordinates.
TControl.ControlToScreen |  | Converts control-relative coordinates to absolute screen coordinates.
TPoint