TextBounds Struct
Describes the width, height, location, and flow direction of a range of text.
public struct TextBounds
Constructors
TextBounds(Double, Double, Double, Double, Boolean)
Initializes a new instance of the TextBounds
structure.
public TextBounds(double x, double y, double width, double height, bool isRightToLeft)
Parameter | Type | Description |
---|---|---|
x | System.Double | Gets the x-axis position of the left side of the bounds. |
y | System.Double | Gets the y-axis position of the top of the bounds. |
width | System.Double | Gets the width of the bounds. |
height | System.Double | Gets the height of the bounds. |
isRightToLeft | System.Boolean | Whether the text is right-to-left. |
TextBounds(Rect, Boolean)
Initializes a new instance of the TextBounds
structure.
public TextBounds(Rect bounds, bool isRightToLeft)
Parameter | Type | Description |
---|---|---|
bounds | System.Windows.Rect | A Rect that specifies the bounds. |
isRightToLeft | System.Boolean | Whether the text is right-to-left. |
Properties
Bottom
public double Bottom { get; }
Property Value
- System.Double:
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 ofNegativeInfinity
.
FlowDirection
Gets the FlowDirection of the text.
public FlowDirection FlowDirection { get; }
Property Value
- System.Windows.FlowDirection:
The FlowDirection of the text.
Height
Gets the height of the bounds.
public double Height { get; }
Property Value
- System.Double:
The height of the bounds.
IsEmpty
Gets a value that indicates whether this bounds is the Empty bounds.
public bool IsEmpty { get; }
Property Value
- System.Boolean:
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
- System.Boolean:
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
- System.Boolean:
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
- System.Boolean:
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 double Left { get; }
Property Value
- System.Double:
The x-axis position of the left side of the bounds.
Rect
Gets a Rect
that specifies the bounds.
public Rect Rect { get; }
Property Value
- System.Windows.Rect:
A
Rect
that specifies the bounds.
Right
public double Right { get; }
Property Value
- System.Double:
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 double Top { get; }
Property Value
- System.Double:
The y-axis position of the top of the bounds.
Width
Gets the width of the bounds.
public double Width { get; }
Property Value
- System.Double:
The width of the bounds.
X
Gets the x-axis position of the left side of the bounds.
public double X { get; }
Property Value
- System.Double:
The x-axis position of the left side of the bounds.
Y
Gets the y-axis position of the top of the bounds.
public double Y { get; }
Property Value
- System.Double:
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 | System.Object | The |
Returns
- System.Boolean:
true
if the specifiedObject
is equal to the currentObject
; otherwise,false
.
GetHashCode()
Returns a hash code for this object.
public override int GetHashCode()
Returns
- System.Int32:
An integer value that specifies a hash value for this object.
ToString()
Converts the object to a String
.
public override string ToString()
Returns
- System.String:
A string whose value represents this object.
Operators
Equality(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
- System.Boolean:
true
if the values ofleft
andright
are equal; otherwise,false
.
Inequality(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
- System.Boolean:
true
if the values ofleft
andright
are unequal; otherwise,false
.
Inherited Members
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetType()