Diagram for .NET / User's Guide / Document Object Model / Models / Primitives / Texts

Texts

Texts are primitive models, which are used to display wrapped or stretched text. They are represented by the NTextPrimitive class (derived from NPrimitiveModel). The text displayed by a text primitive is controlled by the value of its Text property.

Texts support stretched and wrapped display of its text. The current mode is controlled by the Mode property (accepts a value from the BoxTextMode enumeration). The following example creates two texts - one stretched and one wrapped with different fonts and sizes:

C#
Copy Code
// create a wrapped text 
NText text1 = new NText("Wrapped Text", 10, 10, 100, 100);
text1.Mode = BoxTextMode.Wrap;
text1.Style.TextStyle = new NTextStyle(new Font("Verdana", 12));

// create stretched text
NText text2 = new NText("Stretched Text", 10, 110, 100, 100);
text2.Mode = BoxTextMode.Stretch;
text2.Style.TextStyle = new NTextStyle(new Font("Arial", 10));
Visual Basic
Copy Code
' create a wrapped text
Dim text1 As New NText("Wrapped Text", 10, 10, 100, 100)
text1.Mode = BoxTextMode.Wrap
text1.Style.TextStyle = New NTextStyle(New Font("Verdana", 12))

' create stretched text
Dim text2 As New NText("Stretched Text", 10, 110, 100, 100)
text2.Mode = BoxTextMode.Stretch
text2.Style.TextStyle = New NTextStyle(New Font("Arial", 10))
 Related Examples
Windows Forms: Document Object Model - Shapes - Text Shapes
See Also