ToolStripTextBox.GetCharIndexFromPosition(Point) 方法

定義

擷取最接近指定位置之字元的索引。

public:
 int GetCharIndexFromPosition(System::Drawing::Point pt);
public int GetCharIndexFromPosition (System.Drawing.Point pt);
member this.GetCharIndexFromPosition : System.Drawing.Point -> int
Public Function GetCharIndexFromPosition (pt As Point) As Integer

參數

pt
Point

要搜尋的位置。

傳回

Int32

指定位置處的以零為起始的字元索引。

備註

這個方法會傳回最接近 參數中所指定位置的 pt 字元索引。 字元索引是 控制項中文字以零起始的索引,包括空格。 您可以使用這個方法,藉由將滑鼠座標傳遞至此方法,來判斷使用者在文字中將滑鼠移至何處。 如果您想要在滑鼠指標停留在控制項文字中的單字上方時執行工作,這非常有用。

適用於

另請參閱