Direction Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets the writing direction. A paragraph's writing direction can be either left to right or right to left.
Syntax
public Direction Direction { get; set; }Public Property Direction As DirectionMembers
| Value | Description |
|---|---|
| LeftToRight | The writing direction is left to right, which means that blocks of text with left to right and right to left characters are ordered from left to right. |
| RightToLeft | The writing direction is right to left, which means that blocks of text with left to right and right to left characters are ordered from right to left. |
Examples
The following example applies paragraph layout to selected report text by using ParagraphFormat.Direction.
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;
paragraphFormat.Direction = Direction.LeftToRight;
Console.WriteLine($"Direction used by Paragraph Format: {paragraphFormat.Direction}");
textControl.Selection.ParagraphFormat = paragraphFormat;textControl.Text = "First item" & vbCrLf & "Second item" & vbCrLf & "Third item"
textControl.Select(0, textControl.Text.Length)
Dim paragraphFormat As ParagraphFormat = textControl.Selection.ParagraphFormat
paragraphFormat.Direction = Direction.LeftToRight
Console.WriteLine($"Direction used by Paragraph Format: {paragraphFormat.Direction}")
textControl.Selection.ParagraphFormat = paragraphFormatRemarks
The property's default value is Direction.LeftToRight.
The property returns its default value, if the text selection contains multiple paragraphs with mixed direction. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.