windowsforms-devexpress-dot-utils-dot-appearanceobject.md
Gets or sets the foreground color.
Namespace : DevExpress.Utils
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
[XtraSerializableProperty]
[DXCategory("Appearance")]
public Color ForeColor { get; set; }
<XtraSerializableProperty>
<DXCategory("Appearance")>
Public Property ForeColor As Color
| Type | Description |
|---|---|
| Color |
A Color structure specifying the foreground color.
|
Setting the ForeColor property to Color.Empty automatically sets the AppearanceOptions.UseForeColor property to false. If this property is set to false and the current appearance object has a parent, the parent’s foreground color is used.
Use the AppearanceObject.GetForeColor method to obtain the foreground 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 ForeColor 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#L109
case (DevExpress.Utils.Drawing.ObjectState.Hot):
cell.Appearance.ForeColor = Color.DarkGoldenrod;
cell.Appearance.BackColor = Color.PaleGreen;
winforms-listbox-item-templates-enable-word-wrap/CS/S131055/Form1.cs#L46
TextUtils.DrawString(e.Graphics, control.GetItemText(e.Index), control.Appearance.Font,
control.Appearance.ForeColor, e.Bounds);
e.Handled = true;
if (appearance.Options.UseForeColor)
font.Color = appearance.ForeColor;
cell.ApplyFormatting(font);
winforms-lookup-custom-draw-rows-cells-column-headers/CS/WindowsApplication3/Main.cs#L20
e.Appearance.BackColor = Color.Blue;
e.Appearance.ForeColor = Color.White;
}
winforms-ribbon-paint-bar-items/CS/WindowsApplication3/Form1.cs#L15
if(link is BarSubItemLink)
e.RibbonItemInfo.Appearance.ForeColor = Color.Red;
if(link.Item.Name == "barButtonItem1") {
winforms-scheduler-country-specific-work-week-holidays/VB/Form1.vb#L100
Case(DevExpress.Utils.Drawing.ObjectState.Hot)
cell.Appearance.ForeColor = Color.DarkGoldenrod
cell.Appearance.BackColor = Color.PaleGreen
winforms-listbox-item-templates-enable-word-wrap/VB/S131055/Form1.vb#L44
e.Appearance.DrawBackground(e.Cache, e.Bounds)
TextUtils.DrawString(e.Graphics, control.GetItemText(e.Index), control.Appearance.Font, control.Appearance.ForeColor, e.Bounds)
e.Handled = True
winforms-scheduler-display-custom-tooltips/VB/Form1.vb#L34
ttiFooter.Appearance.BackColor = Color.Red
ttiFooter.Appearance.ForeColor = Color.Blue
ttiFooter.LeftIndent = 30
font.Underline = If(appearanceFont.Underline, XlUnderlineType.Single, XlUnderlineType.None)
If appearance.Options.UseForeColor Then font.Color = appearance.ForeColor
cell.ApplyFormatting(font)
winforms-lookup-custom-draw-rows-cells-column-headers/VB/WindowsApplication3/Main.vb#L20
e.Appearance.BackColor = Color.Blue
e.Appearance.ForeColor = Color.White
End If
See Also