Skip to main content
A newer version of this page is available. .
All docs
V21.2

TextEdit.GetCharIndexFromPosition(Point) Method

Retrieves the index of the character closest to the specified location.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v21.2.dll

NuGet Packages: DevExpress.Win.Design, DevExpress.Win.Navigation

Declaration

public virtual int GetCharIndexFromPosition(
    Point pt
)

Parameters

Name Type Description
pt Point

The location (relative to the control’s top left corner) from which to find the nearest character.

Returns

Type Description
Int32

The zero-based index of the character closest to the specified location.

Remarks

This method returns the index of the chacacter that is closest to the position specified in the pt parameter.

Note

If the specified location is not within the control’s client rectangle, or is beyond the editor’s last character, the return value is the index of the last character.

See Also