Читати англійською Редагувати

Поділитися через


TextBox.GetRectFromCharacterIndex Method

Definition

Returns the rectangle for an edge of the character at the specified index.

Overloads

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.

C#
public System.Windows.Rect GetRectFromCharacterIndex(int charIndex);

Parameters

charIndex
Int32

The zero-based character index of the character for which to retrieve the rectangle.

Returns

A rectangle for the leading edge of the character at the specified character index, or Empty if a bounding rectangle cannot be determined.

Remarks

Because this method returns a rectangle that represents an edge of the character, the width of the rectangle is 0.

Applies to

.NET Framework 4.8.1 та інші версії
Продукт Версії
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

GetRectFromCharacterIndex(Int32, Boolean)

Returns the rectangle for the leading or trailing edge of the character at the specified index.

C#
public System.Windows.Rect GetRectFromCharacterIndex(int charIndex, bool trailingEdge);

Parameters

charIndex
Int32

The zero-based character index of the character for which to retrieve the rectangle.

trailingEdge
Boolean

true to get the trailing edge of the character; false to get the leading edge of the character.

Returns

A rectangle for an edge of the character at the specified character index, or Empty if a bounding rectangle cannot be determined.

Exceptions

charIndex is negative or is greater than the length of the content.

Remarks

Because this method returns a rectangle that represents an edge of the character, the width of the rectangle is 0.

Applies to

.NET Framework 4.8.1 та інші версії
Продукт Версії
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10