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。

適用於

另請參閱