TopDistance Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets a top distance, in twips, between this and the previous paragraph.
Syntax
public int TopDistance { get; set; }Public Property TopDistance As IntegerExamples
The following example applies paragraph layout to selected report text by using ParagraphFormat.TopDistance.
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;
paragraphFormat.TopDistance = 720;
Console.WriteLine($"Top Distance used by Paragraph Format: {paragraphFormat.TopDistance}");
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.TopDistance = 720
Console.WriteLine($"Top Distance used by Paragraph Format: {paragraphFormat.TopDistance}")
textControl.Selection.ParagraphFormat = paragraphFormatRemarks
The property's default value is 0.
The property returns its default value when the text selection contains multiple paragraphs with mixed top distances. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.