|
| 1 | +--- |
| 2 | +title: Setting Document Background and Editor Background in UI for WinForms RichTextEditor |
| 3 | +description: Learn how to set the document background and the editor background in UI for WinForms RichTextEditor. |
| 4 | +type: how-to |
| 5 | +page_title: How to Change Document and Editor Background Colors in UI for WinForms RichTextEditor |
| 6 | +meta_title: How to Change Document and Editor Background Colors in UI for WinForms RichTextEditor |
| 7 | +slug: set-document-editor-background-ui-winforms-richtexteditor |
| 8 | +tags: richtexteditor, ui for winforms, document background, editor background, pagebackcolor, backcolor |
| 9 | +res_type: kb |
| 10 | +ticketid: 1700509 |
| 11 | +--- |
| 12 | + |
| 13 | +## Environment |
| 14 | +<table> |
| 15 | +<tbody> |
| 16 | +<tr> |
| 17 | +<td>Product</td> |
| 18 | +<td>RichTextEditor for UI for WinForms</td> |
| 19 | +</tr> |
| 20 | +<tr> |
| 21 | +<td>Version</td> |
| 22 | +<td>2025.3.812</td> |
| 23 | +</tr> |
| 24 | +</tbody> |
| 25 | +</table> |
| 26 | + |
| 27 | +## Description |
| 28 | + |
| 29 | +I want to set the document's background color to white and the editor's background color to gray in the [RichTextEditor](https://docs.telerik.com/devtools/winforms/controls/richtexteditor/overview) component of UI for WinForms. |
| 30 | + |
| 31 | +This knowledge base article also answers the following questions: |
| 32 | +- How to customize the background color of RichTextEditor pages? |
| 33 | +- How to set different colors for the RichTextEditor editor and document? |
| 34 | +- How to use PageBackColor and BackColor properties in UI for WinForms RichTextEditor? |
| 35 | + |
| 36 | +## Solution |
| 37 | + |
| 38 | +To set the desired background colors for the document and editor: |
| 39 | + |
| 40 | +1. Use the `RichTextBoxElement.BackColor` property to assign a color to the editor background. |
| 41 | +2. Use the `RadRichTextEditor.PageBackColor` property to assign a color to the document's background. |
| 42 | + |
| 43 | +Example code: |
| 44 | + |
| 45 | +```csharp |
| 46 | +// Set editor background to gray |
| 47 | +this.radRichTextEditor1.RichTextBoxElement.BackColor = Color.LightGray; |
| 48 | + |
| 49 | +// Set document background to white |
| 50 | +this.radRichTextEditor1.PageBackColor = Color.White; |
| 51 | +``` |
| 52 | + |
| 53 | +## See Also |
| 54 | + |
| 55 | +- [RichTextEditor Overview](https://docs.telerik.com/devtools/winforms/controls/richtexteditor/overview) |
| 56 | +- [BackColor Property Documentation](https://docs.telerik.com/devtools/winforms/controls/richtexteditor/api/telerik.winforms.ui.radtextboxelement.backcolor) |
| 57 | +- [PageBackColor Property Documentation](https://docs.telerik.com/devtools/winforms/controls/richtexteditor/api/telerik.winforms.ui.radrichtexteditor.pagebackcolor) |
0 commit comments