Class TextNode
Base class for text nodes and labels.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram
Assembly: Syncfusion.Diagram.Base.dll
Syntax
public class TextNode : Node, IUnitIndependent, IDispatchNodeEvents, ISerializable, INode, ICloneable, IServiceReferenceHolder, IServiceReferenceProvider, IPropertyObserver, IPropertyContainer, IServiceProvider, IGraphNode, IDeserializationCallback, IDisposable
Constructors
TextNode(TextNode)
Initializes a new instance of the TextNode class.
Declaration
public TextNode(TextNode src)
Parameters
Type | Name | Description |
---|---|---|
TextNode | src | The text node source. |
TextNode(SerializationInfo, StreamingContext)
Initializes a new instance of the TextNode class.
Declaration
protected TextNode(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The info. |
System.Runtime.Serialization.StreamingContext | context | The context. |
TextNode(String)
Initializes a new instance of the TextNode class.
Declaration
public TextNode(string strText)
Parameters
Type | Name | Description |
---|---|---|
System.String | strText | The text. |
TextNode(String, RectangleF)
Initializes a new instance of the TextNode class.
Declaration
public TextNode(string strText, RectangleF rectBounds)
Parameters
Type | Name | Description |
---|---|---|
System.String | strText | The text. |
System.Drawing.RectangleF | rectBounds | The rect bounds. |
TextNode(String, RectangleF, MeasureUnits)
Initializes a new instance of the TextNode class.
Declaration
public TextNode(string strText, RectangleF rectBounds, MeasureUnits measureUnits)
Parameters
Type | Name | Description |
---|---|---|
System.String | strText | The text. |
System.Drawing.RectangleF | rectBounds | The rect bounds. |
MeasureUnits | measureUnits | The measure units. |
Properties
BackgroundStyle
Gets text background style.
Declaration
public FillStyle BackgroundStyle { get; }
Property Value
Type |
---|
FillStyle |
DirectionRightToLeft
Gets or sets a value indicating whether the text is right to left.
Declaration
public bool DirectionRightToLeft { get; set; }
Property Value
Type |
---|
System.Boolean |
DirectionVertical
Gets or sets a value indicating whether the text is vertical.
Declaration
public bool DirectionVertical { get; set; }
Property Value
Type |
---|
System.Boolean |
FitBlackBox
Gets or sets a value indicating whether no part of any glyph overhangs the bounding rectangle.
Declaration
public bool FitBlackBox { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default some glyphs overhang the rectangle slightly where necessary to appear at the edge visually. For example when an italic lowercase letter f in a font such as Garamond is aligned at the far left of a rectangle, the lower part of the f will reach slightly further left than the left edge of the rectangle. Setting this flag will ensure no painting outside the rectangle but will cause the aligned edges of adjacent lines of text to appear uneven.
FontColorStyle
Gets font color style.
Declaration
public FillStyle FontColorStyle { get; }
Property Value
Type |
---|
FillStyle |
FontStyle
Gets the font used to draw the text.
Declaration
public FontStyle FontStyle { get; }
Property Value
Type |
---|
FontStyle |
FormatFlags
Gets flags used to format the text.
Declaration
public StringFormatFlags FormatFlags { get; }
Property Value
Type |
---|
System.Drawing.StringFormatFlags |
Remarks
See System.Drawing.StringFormatFlags for more details.
HorizontalAlignment
Specifies how an object or text in a control is horizontally aligned relative to an element of the control.
Declaration
public StringAlignment HorizontalAlignment { get; set; }
Property Value
Type |
---|
System.Drawing.StringAlignment |
Remarks
This property is used by the GetStringFormat() method to generate a System.Drawing.StringFormat object. This property corresponds to the Alignment property in the System.Drawing.StringFormat class.
LineLimit
Gets or sets a value indicating whether only entire lines are laid out in the formatting rectangle.
Declaration
public bool LineLimit { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, layout continues until the end of the text, or until no more lines are visible as a result of clipping, whichever comes first. Note that the default settings allow the last line to be partially obscured by a formatting rectangle that is not a whole multiple of the line height. To ensure that only whole lines are seen, specify this value and be careful to provide a formatting rectangle at least as tall as the height of one line.
MeasureTrailingSpaces
Gets or sets a value indicating whether space at the end of each line in calculations that measure the size of the text.
Declaration
public bool MeasureTrailingSpaces { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, the boundary rectangle returned by the MeasureString method excludes the space at the end of each line. Set this flag to include that space in measurement.
NoClip
Gets or sets a value indicating whether overhanging parts of glyphs and unwrapped text reaching outside the formatting rectangle are allowed to show.
Declaration
public bool NoClip { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
By default, all text and glyph parts reaching outside the formatting rectangle are clipped.
ReadOnly
Gets or sets a value indicating whether the text object is Read-only or not.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type |
---|
System.Boolean |
Text
Gets or sets the value contained by the text object.
Declaration
public string Text { get; set; }
Property Value
Type |
---|
System.String |
Remarks
Derived classes override this property in order to supply the text value in an implementation-specific way.
TextCase
Gets or sets case of text in the RichTextNode
Declaration
public TextCases TextCase { get; set; }
Property Value
Type |
---|
TextCases |
VerticalAlignment
Gets or sets the vertical alignment of the text.
Declaration
public StringAlignment VerticalAlignment { get; set; }
Property Value
Type |
---|
System.Drawing.StringAlignment |
Remarks
This property is used by the GetStringFormat() method to generate a System.Drawing.StringFormat object. This property corresponds to the LineAlignment property in the System.Drawing.StringFormat class.
WrapText
Gets or sets a value indicating whether text should be wrapped when it exceeds the width of the bounding box.
Declaration
public bool WrapText { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Overrides
Dispose()
Declaration
public override void Dispose()
Overrides
GetObjectData(SerializationInfo, StreamingContext)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
Declaration
protected override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
System.Runtime.Serialization.StreamingContext | context | The destination (see System.Runtime.Serialization.StreamingContext) for this serialization. |
Overrides
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | The caller does not have the required permission. |
GetPropertyContainer(String)
Gets the property container.
Declaration
protected override object GetPropertyContainer(string strPropertyContainerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | strPropertyContainerName | Name of the property container. |
Returns
Type | Description |
---|---|
System.Object | Property container. |
Overrides
GetStringFormat()
Creates a StringFormat object that encapsulates the properties of the text object.
Declaration
public StringFormat GetStringFormat()
Returns
Type | Description |
---|---|
System.Drawing.StringFormat | System.Drawing.StringFormat object. |
Remarks
The System.Drawing.StringFormat object returned by this method is used to draw the text using the System.Drawing.Graphics.DrawString method.
Render(Graphics)
Renders shapes visual representation on given graphics.
Declaration
protected override void Render(Graphics gfx)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | gfx | Graphics to draw on |
Overrides
SizeToText(Graphics, SizeF)
Adjusts the size of the bounding box to fit the text.
Declaration
public SizeF SizeToText(Graphics grfx, SizeF layoutArea)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | grfx | Graphics context used to measure the text. |
System.Drawing.SizeF | layoutArea | Maximum layout size of the string. |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | New size of the bounding box. |
Remarks
Uses the System.Drawing.Graphics.MeasureString method to calculate the size of the bounding box based on the font and text value.
SizeToText(SizeF)
Adjusts the size of the bounding box to fit the text.
Declaration
public SizeF SizeToText(SizeF layoutArea)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | layoutArea | Maximum layout size of the string. |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | New size of the bounding box. |
Remarks
Uses the System.Drawing.Graphics.MeasureString method to calculate the size of the bounding box based on the font and text value.
UpdateReferences(IServiceReferenceProvider)
Updates the references.
Declaration
public override void UpdateReferences(IServiceReferenceProvider provider)
Parameters
Type | Name | Description |
---|---|---|
IServiceReferenceProvider | provider | The provider. |