In This Article

TextBounds Struct

Describes the width, height, location, and flow direction of a range of text.

public struct TextBounds

Constructors

TextBounds(double, double, double, double, bool)

Initializes an instance of the structure.

public TextBounds(double x, double y, double width, double height, bool isRightToLeft)
Parameter Type Description
x double

Gets the x-axis position of the left side of the bounds.

y double

Gets the y-axis position of the top of the bounds.

width double

Gets the width of the bounds.

height double

Gets the height of the bounds.

isRightToLeft bool

Whether the text is right-to-left.

TextBounds(Rect, bool)

Initializes an instance of the structure.

public TextBounds(Rect bounds, bool isRightToLeft)
Parameter Type Description
bounds Rect

A Rect that specifies the bounds.

isRightToLeft bool

Whether the text is right-to-left.

Properties

Bottom

The y-axis value of the bottom of the bounds.

public readonly double Bottom { get; }

Property Value

double

Remarks

This property is equivalent to the sum of the Y and Height properties.

FlowDirection

The FlowDirection of the text.

public readonly FlowDirection FlowDirection { get; }

Property Value

FlowDirection

Height

The height of the bounds.

public readonly double Height { get; }

Property Value

double

IsLeftToRight

Indicates whether the text is left-to-right.

public readonly bool IsLeftToRight { get; }

Property Value

bool:

true if the text is left-to-right; otherwise, false.

IsRightToLeft

Indicates whether the text is right-to-left.

public readonly bool IsRightToLeft { get; }

Property Value

bool:

true if the text is right-to-left; otherwise, false.

IsYValid

Indicates whether the Y property is a valid value.

public readonly bool IsYValid { get; }

Property Value

bool:

true if the Y property is a valid value; otherwise, false.

Remarks

The Y value may be invalid when getting bounds for a text line that is not currently visible.

Left

The x-axis position of the left side of the bounds.

public readonly double Left { get; }

Property Value

double

Remarks

This property is equivalent to the bounds's X property.

Rect

A rectangle that specifies the bounds.

public readonly Rect Rect { get; }

Property Value

Rect

Right

The x-axis value of the right side of the bounds.

public readonly double Right { get; }

Property Value

double

Remarks

This property is equivalent to the sum of the X and Width properties.

Top

The y-axis position of the top of the bounds.

public readonly double Top { get; }

Property Value

double

Remarks

This property is equivalent to the Y property.

Width

The width of the bounds.

public readonly double Width { get; }

Property Value

double

X

The x-axis position of the left side of the bounds.

public readonly double X { get; }

Property Value

double

Y

The y-axis position of the top of the bounds.

public readonly double Y { get; }

Property Value

double

Methods

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override readonly bool Equals(object? obj)
Parameter Type Description
obj object

The object to compare with the current instance.

Returns

bool:

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int:

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the string representation of this object.

public override readonly string ToString()

Returns

string:

The string representation of this object.

Operators

operator ==(TextBounds, TextBounds)

Compares two TextBounds objects.

public static bool operator ==(TextBounds left, TextBounds right)
Parameter Type Description
left TextBounds

A TextBounds to compare.

right TextBounds

A TextBounds to compare.

Returns

bool:

true if the values of left and right are equal; otherwise, false.

operator !=(TextBounds, TextBounds)

Compares two TextBounds objects.

public static bool operator !=(TextBounds left, TextBounds right)
Parameter Type Description
left TextBounds

A TextBounds to compare.

right TextBounds

A TextBounds to compare.

Returns

bool:

true if the values of left and right are unequal; otherwise, false.

Inherited Members