BackColor Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets the background color of a paragraph. If the background color is transparent, the paragraph's background is the same as the control's background color.
Syntax
public Color BackColor { get; set; }Public Property BackColor As ColorExamples
The following example applies paragraph layout to selected report text by using ParagraphFormat.BackColor.
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;
paragraphFormat.BackColor = System.Drawing.Color.LightSteelBlue;
Console.WriteLine($"Back Color used by Paragraph Format: {paragraphFormat.BackColor}");
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.BackColor = System.Drawing.Color.LightSteelBlue
Console.WriteLine($"Back Color used by Paragraph Format: {paragraphFormat.BackColor}")
textControl.Selection.ParagraphFormat = paragraphFormatRemarks
The property's default value is Color.Transparent.
The property returns its default value when the text selection contains multiple paragraphs with mixed background colors. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.