# Selection.TextBackColor Property

> Gets or sets the background color for selected text.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > Selection.TextBackColor Property
- **548 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/textbackcolor-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/textbackcolor-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/textbackcolor-property/llms-full.txt

---

### Description

Gets or sets the background color for selected text.

### Syntax

```csharp
public Color TextBackColor { get; set; }
```

```vbnet
Public Property TextBackColor As Color
```

### Examples

The following example formats the heading of a short document by using `Selection.TextBackColor`.

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

selection.TextBackColor = System.Drawing.Color.LightSteelBlue;
Console.WriteLine($"Text Back Color used by Selection: {selection.TextBackColor}");
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection

selection.TextBackColor = System.Drawing.Color.LightSteelBlue
Console.WriteLine($"Text Back Color used by Selection: {selection.TextBackColor}")
```

### Remarks

The property's default value is the system color for the window background.

The property returns its default value when the text selection contains multiple characters with mixed colors. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [Selection.Text Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/text-property/llms-full.txt)
- **Next:** [Selection.Underline Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/underline-property/llms-full.txt)
