TextBoxBase.GetPositionFromCharIndex(Int32) 方法

定義

擷取控制項內指定之字元索引的位置。Retrieves the location within the control at the specified character index.

public:
 virtual System::Drawing::Point GetPositionFromCharIndex(int index);
public virtual System.Drawing.Point GetPositionFromCharIndex (int index);
abstract member GetPositionFromCharIndex : int -> System.Drawing.Point
override this.GetPositionFromCharIndex : int -> System.Drawing.Point
Public Overridable Function GetPositionFromCharIndex (index As Integer) As Point

參數

index
Int32

要擷取位置的字元索引。The index of the character for which to retrieve the location.

傳回

Point

控制項之用戶端矩形內指定字元的位置。The location of the specified character within the client rectangle of the control.

備註

這個方法可讓您判斷控制項中特定字元索引所在的位置。This method enables you to determine where in the control a specific character index is located. 您可以使用這個方法來進行這類工作,以顯示快捷方式功能表項目或控制項中文字的說明資訊。You can use this method for such tasks as displaying shortcut menu items or help information for a word in the control. 例如,如果您想要在使用者以滑鼠右鍵按一下控制項中的單字時,對使用者顯示選項的功能表,您可以使用這個方法來判斷文字的位置,以正確地顯示 ContextMenu 控制項。For example, if you wanted to display a menu of options to the user when the user right clicks on a word in the control, you can use this method to determine the position of the word to properly display a ContextMenu control.

適用於

另請參閱