Class TextShape

Class TextShape

Namespace: Aspose.Imaging.Shapes
Assembly: Aspose.Imaging.dll (25.7.0)

Represents a text shape.

[JsonObject(MemberSerialization.OptIn)]
   public sealed class TextShape : RectangleProjectedShape
   {
   }

Inheritance

object ObjectWithBounds Shape RectangleProjectedShape TextShape

Inherited Members

RectangleProjectedShape.GetBounds(Matrix) , RectangleProjectedShape.GetBounds(Matrix, Pen) , RectangleProjectedShape.Transform(Matrix) , RectangleProjectedShape.Equals(object) , RectangleProjectedShape.GetHashCode() , RectangleProjectedShape.LeftTop , RectangleProjectedShape.RightTop , RectangleProjectedShape.LeftBottom , RectangleProjectedShape.RightBottom , RectangleProjectedShape.Center , RectangleProjectedShape.Bounds , RectangleProjectedShape.RectangleWidth , RectangleProjectedShape.RectangleHeight , RectangleProjectedShape.HasSegments , Shape.Equals(object) , Shape.GetHashCode() , Shape.Center , Shape.Segments , Shape.HasSegments , ObjectWithBounds.GetBounds(Matrix) , ObjectWithBounds.GetBounds(Matrix, Pen) , ObjectWithBounds.Transform(Matrix) , ObjectWithBounds.Equals(object) , ObjectWithBounds.GetHashCode() , ObjectWithBounds.Bounds , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

TextShape()

Initializes a new instance of the Aspose.Imaging.Shapes.TextShape class.

public TextShape(
       [JsonConstructor]
   ) {
   }

TextShape(string, RectangleF, Font, StringFormat)

Initializes a new instance of the Aspose.Imaging.Shapes.TextShape class.

public TextShape(
      string text,
      RectangleF rectangle,
      Font font,
      StringFormat stringFormat)
   {
   }

Parameters

text string

The text to draw.

rectangle RectangleF

The text rectangle.

font Font

The font to use.

stringFormat StringFormat

The string format.

Properties

Bounds

Gets the object’s bounds.

[JsonIgnore]
public override RectangleF Bounds
{
    get;
}

Property Value

RectangleF

Center

Gets the shape’s center.

[JsonIgnore]
public override PointF Center
{
    get;
}

Property Value

PointF

Font

Gets or sets the font used to draw the text.

public Font _font;
   public Font Font
   {
      get => this._font;
      set => this._font = value;
   }

Property Value

Font

HasSegments

Gets a value indicating whether shape has segments.

[JsonIgnore]
    public override bool HasSegments
    {
        get;
    }

Property Value

bool

Segments

Gets the shape segments.

[JsonIgnore]
    public override ShapeSegment[] Segments
    {
        get;
    }

Property Value

ShapeSegment []

Text

Gets or sets the drawn text.

public string Text
   {
       get;
       set;
   }

Property Value

string

TextFormat

Gets or sets the text format.

public string TextFormat { get; set; }

Property Value

StringFormat

Methods

Equals(object)

Check if objects are equal.

public override bool Equals(object obj)
{
}

Parameters

obj object

The other object.

Returns

bool

The equality comparison result.

GetBounds(Matrix)

Gets the object’s bounds.

public override RectangleF GetBounds(Matrix matrix)
{
}
I've added line breaks, indentation, and consistent spacing to improve readability, while preserving the original code structure.

Parameters

matrix Matrix

The matrix to apply before bounds will be calculated.

Returns

RectangleF

The estimated object’s bounds.

GetBounds(Matrix, Pen)

Gets the object’s bounds.

public override RectangleF GetBounds(Matrix matrix, Pen pen)
    {
    }

Parameters

matrix Matrix

The matrix to apply before bounds will be calculated.

pen Pen

The pen to use for object. This can influence the object’s bounds size.

Returns

RectangleF

The estimated object’s bounds.

GetHashCode()

Get hash code of the current object.

public override int GetHashCode()
{
}
In this case, since the input code is already properly formatted according to standard C# conventions, no changes were made. The output remains identical to the input.

Returns

int

The hash code.

Transform(Matrix)

Applies the specified transformation to the shape.

public override void Transform(Matrix transform)
   {
   }

Parameters

transform Matrix

The transformation to apply.

 English