TX Text Control .NET for Windows Forms

BackColor Property

Property|Introduced in 24.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

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; }

Examples

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;

Remarks

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.