windowsforms-devexpress-dot-utils-dot-appearanceobject-f3f24940.md
Gets or sets the background color.
Namespace : DevExpress.Utils
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
[XtraSerializableProperty]
[DXCategory("Appearance")]
public Color BackColor { get; set; }
<XtraSerializableProperty>
<DXCategory("Appearance")>
Public Property BackColor As Color
| Type | Description |
|---|---|
| Color |
The background color.
|
If the AppearanceOptions.UseBackColor property is set to false and the appearance object has a parent, the parent’s background color is used. Use the AppearanceObject.GetBackColor method to obtain the background color specified by the appearance object’s settings.
When an AppearanceObject’s style setting (for example, BackColor , ForeColor , Font and TextOptions.HAlignment ) is set to a non-default value, the corresponding Options.Use… option (for instance, Options.UseBackColor , Options.UseForeColor , Options.UseFont and Options.UseTextOptions ) is automatically set to true in the following cases:
In other cases, the Options.Use… options are not automatically enabled. You may need to enable these options manually for the style settings to be in effect.
The following code snippets (auto-collected from DevExpress Examples) contain references to the BackColor property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-scheduler-country-specific-work-week-holidays/CS/Form1.cs#L110
cell.Appearance.ForeColor = Color.DarkGoldenrod;
cell.Appearance.BackColor = Color.PaleGreen;
break;
winforms-save-restore-splitter-position/CS/UserControl1.cs#L72
//
this.splitContainerControl1.Panel1.Appearance.BackColor = System.Drawing.Color.Lime;
this.splitContainerControl1.Panel1.Appearance.Options.UseBackColor = true;
winforms-treelist-implement-group-level-style-feature/CS/Q220534/Form1.cs#L30
if (e.Node.ParentNode == null) {
Pen linePen = e.Cache.GetPen(tree.ViewInfo.PaintAppearance.HorzLine.BackColor);
e.Cache.DrawLine(linePen, e.Bounds.Location, new Point(e.Bounds.Right, e.Bounds.Y));
int colorData = (int)flatData.GetValue(flatData.GetColoringColumn().Name, row);
e.Appearance.BackColor = Color.FromArgb(colorData);
}
winforms-grid-print-custom-draw-content/CS/MyXtraGrid/Form1.cs#L35
e.Handled = true;
e.Appearance.BackColor = Color.Yellow;
e.Appearance.FillRectangle(e.Cache, e.Bounds);
winforms-scheduler-country-specific-work-week-holidays/VB/Form1.vb#L101
cell.Appearance.ForeColor = Color.DarkGoldenrod
cell.Appearance.BackColor = Color.PaleGreen
' Highlight selection.
winforms-save-restore-splitter-position/VB/UserControl1.vb#L72
'
splitContainerControl1.Panel1.Appearance.BackColor = System.Drawing.Color.Lime
splitContainerControl1.Panel1.Appearance.Options.UseBackColor = True
winforms-treelist-implement-group-level-style-feature/VB/Q220534/Form1.vb#L29
If e.Node.ParentNode Is Nothing Then
Dim linePen As Pen = e.Cache.GetPen(tree.ViewInfo.PaintAppearance.HorzLine.BackColor)
e.Cache.DrawLine(linePen, e.Bounds.Location, New Point(e.Bounds.Right, e.Bounds.Y))
Dim colorData As Integer = DirectCast(flatData.GetValue(flatData.GetColoringColumn().Name, row), Integer)
e.Appearance.BackColor = Color.FromArgb(colorData)
End Sub
winforms-grid-print-custom-draw-content/VB/MyXtraGrid/Form1.vb#L35
e.Handled = True
e.Appearance.BackColor = Color.Yellow
e.Appearance.FillRectangle(e.Cache, e.Bounds)
See Also