TCustomRichView.ClientToDocument, DocumentToClient

<< Click to display table of contents >>

TCustomRichView.ClientToDocument, DocumentToClient

The methods convert client coordinates to document coordinates and vice versa.

function ClientToDocument(const APoint: TRVCoordPoint): TRVCoordPoint;

(introduced in v1.9)

function DocumentToClient(const APoint: TRVCoordPoint): TRVCoordPoint;

(introduced in v14)

ClientToDocument converts APoint from the control’s coordinate system to the document coordinate system. DocumentToClient performs an opposite conversion.

In client area coordinates, (0, 0) corresponds to the top left corner of the control's client area. For example, mouse events use this coordinate system.

In document coordinates, (0, 0) corresponds to the top left corner of the scrollable area. For example, GetItemAt uses this coordinate system.

The methods take a cell rotation into account.

Note:

This method must be used instead of adding HScrollPos to X and VScrollPos*VSmallStep to Y. The old method was used in some old example code, it is correct only if the document is top-aligned.

See also:

Example in OnRVMouseDown.