TextBox.GetCharacterIndexFromPoint(Point, Boolean) 方法

定义

返回离指定点最近的字符的从零开始的索引。

public:
 int GetCharacterIndexFromPoint(System::Windows::Point point, bool snapToText);
public int GetCharacterIndexFromPoint(System.Windows.Point point, bool snapToText);
member this.GetCharacterIndexFromPoint : System.Windows.Point * bool -> int
Public Function GetCharacterIndexFromPoint (point As Point, snapToText As Boolean) As Integer

参数

point
Point

要为其返回索引的坐标空间中的 TextBox 点。

snapToText
Boolean

true 如果指定点上没有字符,则返回最近的索引; false 如果指定点没有字符,则返回 -1。

返回

最接近指定点的字符的索引;如果没有找到有效的索引,则 -1。

适用于

另请参阅