Class Text
Represents a Text EntityObject.
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Text : EntityObject, IHasXData, ICloneable
Constructors
| Improve this Doc View SourceText()
Initializes a new instance of the Text class.
Declaration
public Text()
Text(String)
Initializes a new instance of the Text class.
Declaration
public Text(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text string. |
Text(String, Vector2, Double)
Initializes a new instance of the Text class.
Declaration
public Text(string text, Vector2 position, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text string. |
| Vector2 | position | Text Vector2 in world coordinates. |
| System.Double | height | Text height. |
Text(String, Vector2, Double, TextStyle)
Initializes a new instance of the Text class.
Declaration
public Text(string text, Vector2 position, double height, TextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text string. |
| Vector2 | position | Text Vector2 in world coordinates. |
| System.Double | height | Text height. |
| TextStyle | style | Text TextStyle. |
Text(String, Vector3, Double)
Initializes a new instance of the Text class.
Declaration
public Text(string text, Vector3 position, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text string. |
| Vector3 | position | Text Vector3 in world coordinates. |
| System.Double | height | Text height. |
Text(String, Vector3, Double, TextStyle)
Initializes a new instance of the Text class.
Declaration
public Text(string text, Vector3 position, double height, TextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text string. |
| Vector3 | position | Text Vector3 in world coordinates. |
| System.Double | height | Text height. |
| TextStyle | style | Text TextStyle. |
Properties
| Improve this Doc View SourceAlignment
Gets or sets the text alignment.
Declaration
public TextAlignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment |
DefaultMirrText
Gets or sets if the text will be mirrored when a symmetry is performed, when the current Text entity does not belong to a DXF document.
Declaration
public static bool DefaultMirrText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Height
Gets or sets the text height.
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values must be greater than zero. Default: 1.0.
When Alignment.Aligned is used this value is not applicable, it will be automatically adjusted so the text will fit in the specified width.
IsBackward
Gets or sets if the text is backward (mirrored in X).
Declaration
public bool IsBackward { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsUpsideDown
Gets or sets if the text is upside down (mirrored in Y).
Declaration
public bool IsUpsideDown { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ObliqueAngle
Gets or sets the font oblique angle.
Declaration
public double ObliqueAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from -85 to 85. Default: 0.0.
Position
Gets or sets Text Vector3 in world coordinates.
Declaration
public Vector3 Position { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Rotation
Gets or sets the text rotation in degrees.
Declaration
public double Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Style
Gets or sets the TextStyle.
Declaration
public TextStyle Style { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle |
Value
Gets or sets the text string.
Declaration
public string Value { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Width
Gets or sets the text width, only applicable for text Alignment.Fit and Alignment.Align.
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values must be greater than zero. Default: 1.0.
WidthFactor
Gets or sets the width factor.
Declaration
public double WidthFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
Valid values range from 0.01 to 100. Default: 1.0.
When Alignment.Fit is used this value is not applicable, it will be automatically adjusted so the text will fit in the specified width.
Methods
| Improve this Doc View SourceClone()
Creates a new Text that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new Text that is a copy of this instance. |
Overrides
| Improve this Doc View SourceOnTextStyleChangedEvent(TextStyle, TextStyle)
Declaration
protected virtual TextStyle OnTextStyleChangedEvent(TextStyle oldTextStyle, TextStyle newTextStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| TextStyle | oldTextStyle | |
| TextStyle | newTextStyle |
Returns
| Type | Description |
|---|---|
| TextStyle |
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current entity given a 3x3 transformation matrix and a translation vector.
Declaration
public override void TransformBy(Matrix3 transformation, Vector3 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3 | transformation | Transformation matrix. |
| Vector3 | translation | Translation vector. |
Overrides
Remarks
When the current Text entity does not belong to a DXF document, the text will use the DefaultMirrText when a symmetry is performed;
otherwise, the drawing variable MirrText will be used.
A symmetry around the X axis when the text uses an Alignment.BaseLineLeft, Alignment.BaseLineCenter, Alignment.BaseLineRight, Alignment.Fit or an Alignment.Aligned.
A symmetry around the Y axis when the text uses an Alignment.Fit or an Alignment.Aligned.
Matrix3 adopts the convention of using column vectors to represent a transformation matrix.
Events
| Improve this Doc View SourceTextStyleChanged
Declaration
public event Text.TextStyleChangedEventHandler TextStyleChanged
Event Type
| Type | Description |
|---|---|
| Text.TextStyleChangedEventHandler |