TextBoxBase.GetCharFromPosition(Point) 方法

定義

擷取最接近控制項內指定位置的字元。Retrieves the character that is closest to the specified location within the control.

public:
 virtual char GetCharFromPosition(System::Drawing::Point pt);
public virtual char GetCharFromPosition (System.Drawing.Point pt);
abstract member GetCharFromPosition : System.Drawing.Point -> char
override this.GetCharFromPosition : System.Drawing.Point -> char
Public Overridable Function GetCharFromPosition (pt As Point) As Char

參數

pt
Point

要從其中尋找最接近字元的位置。The location from which to seek the nearest character.

傳回

Char

在指定位置的字元。The character at the specified location.

備註

如果在參數中指定的位置 pt 超出控制項的工作區,則會傳回最接近指定之點的字串第一個字元 ptIf the location specified in the pt parameter is outside the client area of the control, the first character of the string closest to the point specified in pt is returned. 您可以使用這個方法來判斷哪些字元位於控制項內的特定點附近。You can use this method to determine which characters are located near a specific point within the control. 然後,您可以使用此值來對該位置上的文字執行作業。You can then use this value to perform operations on the text at that location.

注意

如果參數中指定的位置 pt 位於控制項工作區的右側,則會傳回最接近指定之點的字串最後一個字元 ptIf the specified location in the pt parameter is located on the right side of the client area of the control, the last character of the string closest to the point specified in pt is returned.

適用於

另請參閱