windowsforms-devexpress-dot-utils-dot-appearanceobject-736f5a88.md
Gets or sets the border color.
Namespace : DevExpress.Utils
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
[XtraSerializableProperty]
[DXCategory("Appearance")]
public Color BorderColor { get; set; }
<XtraSerializableProperty>
<DXCategory("Appearance")>
Public Property BorderColor As Color
| Type | Description |
|---|---|
| Color |
A Color object specifying the border color.
|
Setting the BorderColor property to Color.Empty automatically sets the appearance object’s AppearanceOptions.UseBorderColor property to false. If this property is set to false and the current appearance has a parent, the parent’s border color is used.
The code below shows how to set a custom border color for a button.
simpleButton1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Office2003;
simpleButton1.Appearance.BorderColor = Color.Red;
simpleButton1.Appearance.Options.UseBorderColor = true;
simpleButton1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Office2003
simpleButton1.Appearance.BorderColor = Color.Red
simpleButton1.Appearance.Options.UseBorderColor = True
Use the AppearanceObject.GetBorderColor method to obtain the border 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 snippet (auto-collected from DevExpress Examples) contains a reference to the BorderColor 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-grid-print-custom-draw-content/CS/MyXtraGrid/MyGridView/MyGridViewPrintInfo.cs#L58
BorderSide border = args.Appearance.Options.UseBorderColor? BorderSide.All: BorderSide.None;
ImageBrick ib = new ImageBrick(border, 1, args.Appearance.BorderColor, args.Appearance.BackColor);
ib.Rect = rect;
winforms-grid-print-custom-draw-content/VB/MyXtraGrid/MyGridView/MyGridViewPrintInfo.vb#L59
Dim border As BorderSide = If(args.Appearance.Options.UseBorderColor, BorderSide.All, BorderSide.None)
Dim ib As New ImageBrick(border, 1, args.Appearance.BorderColor, args.Appearance.BackColor)
ib.Rect = rect
See Also