TextBox.GetRectFromCharacterIndex 方法

定义

返回指定索引处字符的某个边缘的边框。Returns the rectangle for an edge of the character at the specified index.

重载

GetRectFromCharacterIndex(Int32)

返回指定索引处字符的前边缘的边框。Returns the rectangle for the leading edge of the character at the specified index.

GetRectFromCharacterIndex(Int32, Boolean)

返回指定索引处字符的前边缘或后边缘的边框。Returns the rectangle for the leading or trailing edge of the character at the specified index.

GetRectFromCharacterIndex(Int32)

返回指定索引处字符的前边缘的边框。Returns the rectangle for the leading edge of the character at the specified index.

public:
 System::Windows::Rect GetRectFromCharacterIndex(int charIndex);
public System.Windows.Rect GetRectFromCharacterIndex (int charIndex);
member this.GetRectFromCharacterIndex : int -> System.Windows.Rect
Public Function GetRectFromCharacterIndex (charIndex As Integer) As Rect

参数

charIndex
Int32

要检索其边框的字符的字符索引,该索引从零开始。The zero-based character index of the character for which to retrieve the rectangle.

返回

指定字符索引处字符的前边缘的边框;如果无法确定边框,则为 EmptyA rectangle for the leading edge of the character at the specified character index, or Empty if a bounding rectangle cannot be determined.

注解

因为此方法返回一个表示字符边缘的矩形, 所以矩形的宽度为0。Because this method returns a rectangle that represents an edge of the character, the width of the rectangle is 0.

GetRectFromCharacterIndex(Int32, Boolean)

返回指定索引处字符的前边缘或后边缘的边框。Returns the rectangle for the leading or trailing edge of the character at the specified index.

public:
 System::Windows::Rect GetRectFromCharacterIndex(int charIndex, bool trailingEdge);
public System.Windows.Rect GetRectFromCharacterIndex (int charIndex, bool trailingEdge);
member this.GetRectFromCharacterIndex : int * bool -> System.Windows.Rect
Public Function GetRectFromCharacterIndex (charIndex As Integer, trailingEdge As Boolean) As Rect

参数

charIndex
Int32

要检索其边框的字符的字符索引,该索引从零开始。The zero-based character index of the character for which to retrieve the rectangle.

trailingEdge
Boolean

如果获取字符的后边缘,则为 true;如果获取字符的前边缘,则为 falsetrue to get the trailing edge of the character; false to get the leading edge of the character.

返回

指定字符索引处字符某个边缘的边框;如果无法确定边框,则为 EmptyA rectangle for an edge of the character at the specified character index, or Empty if a bounding rectangle cannot be determined.

异常

charIndex 为负,或大于内容的长度。charIndex is negative or is greater than the length of the content.

注解

因为此方法返回一个表示字符边缘的矩形, 所以矩形的宽度为0。Because this method returns a rectangle that represents an edge of the character, the width of the rectangle is 0.

适用于