VCL Delphi

Title: Understanding ScreenToClient and ClientToScreen Delphi VCL methods
Every Delphi control, descendant of the TControl class, exposes two methods you can use to convert point coordinates: ScreenToClient and ClientToScreen.
In screen coordinates (0, 0) corresponds to the upper left corner of the screen.
In client area coordinates (0, 0) corresponds to the upper left corner of the control's client area.
ScreenToClient
Declared as
function ScreenToClient(const Point: TPoint): TPoint;
ScreenToClient method is used when you need to convert a point in screen coordinates to local, or client area, coordinates.
For example, the Mouse.CursorPos returns the position of the mouse cursor in screen coordinates.
To get the coordinates of the mouse "inside" a Delphi control, you can convert this value using
Control.ScreenToClient(Mouse.CursorPos).
ClientToScreen
Declared as
function ClientToScreen(const Point: TPoint): TPoint;
ScreenToClient translates a given point from client area coordinates to global screen coordinates.
An Example
A great example of using the ScreenToClient method is when you need to know which TStatusBar Panel was clicked.