# Selection.ForeColor Property

> Returns or sets the color used to display the 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.ForeColor Property
- **545 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/forecolor-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/forecolor-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/forecolor-property/llms-full.txt

---

### Description

Returns or sets the color used to display the selected text.

### Syntax

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

```vbnet
Public Property ForeColor As Color
```

### Examples

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

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

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

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

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

### Limitations

Runtime only.

### Remarks

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

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.FontSize Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/fontsize-property/llms-full.txt)
- **Next:** [Selection.FormattingStyle Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/formattingstyle-property/llms-full.txt)
