In This Article

TextBounds Struct

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

public struct TextBounds

Constructors

TextBounds(Rectangle, bool)

Initializes a new instance of the TextBounds structure.

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

A Rect that specifies the bounds.

isRightToLeft bool

Whether the text is right-to-left.

TextBounds(int, int, int, int, bool)

Initializes a new instance of the TextBounds structure.

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

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

y int

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

width int

Gets the width of the bounds.

height int

Gets the height of the bounds.

isRightToLeft bool

Whether the text is right-to-left.

Properties

Bottom

Gets the y-axis value of the bottom of the bounds (Y + Height).

public int Bottom { get; }

Property Value

int:

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

Empty

Gets the empty bounds, a special value that represents a bounds with no position or area.

public static TextBounds Empty { get; }

Property Value

TextBounds:

The empty rectangle, which has X and Y values of PositiveInfinity, and has Width and Height values of NegativeInfinity.

Height

Gets the height of the bounds.

public int Height { get; }

Property Value

int:

The height of the bounds.

IsEmpty

Gets a value that indicates whether this bounds is the Empty bounds.

public bool IsEmpty { get; }

Property Value

bool:

true if this rectangle is the Empty rectangle; otherwise, false.

IsLeftToRight

Gets whether the text is left-to-right.

public bool IsLeftToRight { get; }

Property Value

bool:

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

IsRightToLeft

Gets whether the text is right-to-left.

public bool IsRightToLeft { get; }

Property Value

bool:

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

IsYValid

Gets a value that indicates whether the Y property is a valid value.

public 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

Gets the x-axis position of the left side of the bounds. Getting this property is equivalent to getting the bounds's X property.

public int Left { get; }

Property Value

int:

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

Rect

Gets a Rect that specifies the bounds.

public Rectangle Rect { get; }

Property Value

Rectangle:

A Rect that specifies the bounds.

Right

Gets the x-axis value of the right side of the bounds (X + Width).

public int Right { get; }

Property Value

int:

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

Top

Gets the y-axis position of the top of the bounds. Getting this property is equivalent to getting the bounds's Y property.

public int Top { get; }

Property Value

int:

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

Width

Gets the width of the bounds.

public int Width { get; }

Property Value

int:

The width of the bounds.

X

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

public int X { get; }

Property Value

int:

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

Y

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

public int Y { get; }

Property Value

int:

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

Methods

Equals(object)

Determines whether the specified Object is equal to the current Object.

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

The Object to compare to the current Object.

Returns

bool:

true if the specified Object is equal to the current Object; otherwise, false.

GetHashCode()

Returns a hash code for this object.

public override int GetHashCode()

Returns

int:

An integer value that specifies a hash value for this object.

ToString()

Converts the object to a String.

public override string ToString()

Returns

string:

A string whose value represents 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