# SubTextPart.HighlightColor Property

> Gets or sets the highlight color for the subtextpart. A subtextpart is highlighted, if it contains the current text input position. The color's alpha value must be less than 255 (opaque) so that the textpart's text remains visible. The default value is red with an alpha value of 60.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 23.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 WPF > Reference > TXTextControl > SubTextPart.HighlightColor Property
- **576 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/highlightcolor-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/highlightcolor-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/highlightcolor-property/llms-full.txt

---

### Description

Gets or sets the highlight color for the subtextpart. A subtextpart is highlighted, if it contains the current text input position. The color's alpha value must be less than 255 (opaque) so that the textpart's text remains visible. The default value is red with an alpha value of 60.

### Syntax

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

```vbnet
Public Property HighlightColor As Color
```

### Examples

The following example marks the selected customer name as a named document region by using `SubTextPart.HighlightColor`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
SubTextPart subTextPart = new("CustomerName", 10);
textControl.SubTextParts.Add(subTextPart);

subTextPart.HighlightColor = System.Drawing.Color.LightSteelBlue;
Console.WriteLine($"Highlight Color used by Sub Text Part: {subTextPart.HighlightColor}");
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim subTextPart As New SubTextPart("CustomerName", 10)
textControl.SubTextParts.Add(subTextPart)

subTextPart.HighlightColor = System.Drawing.Color.LightSteelBlue
Console.WriteLine($"Highlight Color used by Sub Text Part: {subTextPart.HighlightColor}")
```

---

## Nearby

- **Previous:** [SubTextPart.GetTextFields Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/gettextfields-method/llms-full.txt)
- **Next:** [SubTextPart.HighlightMode Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/subtextpart/highlightmode-property/llms-full.txt)
