Back to Devexpress

WindowsFormsSettings.TrackWindowsAccentColor Property

windowsforms-devexpress-dot-xtraeditors-dot-windowsformssettings-9ab28604.md

latest4.7 KB
Original Source

WindowsFormsSettings.TrackWindowsAccentColor Property

Gets or sets whether to use the Accent Color setting in Windows OS and apply it to all color palettes of vector skins except the High Contrast skin.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.Utils.v25.2.dll

NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core

Declaration

csharp
public static DefaultBoolean TrackWindowsAccentColor { get; set; }
vb
Public Shared Property TrackWindowsAccentColor As DefaultBoolean

Property Value

TypeDescription
DefaultBoolean

DefaultBoolean.True to use the Accent Color setting in Windows OS and apply it to all color palettes of vector skins; otherwise, DefaultBoolean.False or DefaultBoolean.Default.

|

Available values:

NameDescriptionReturn Value
True

The value is true.

|

0

| | False |

The value is false.

|

1

| | Default |

The value is specified by a global option or a higher-level object.

|

2

|

Remarks

Important

The WindowsFormsSettings.TrackWindowsAccentColor setting does not work in the High Contrast skin.

csharp
using DevExpress.XtraEditors;

static void Main() {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    WindowsFormsSettings.TrackWindowsAccentColor = DevExpress.Utils.DefaultBoolean.True;
    Application.Run(new Form1());
}
vb
Imports DevExpress.XtraEditors

Shared Sub Main()
    Application.EnableVisualStyles()
    Application.SetCompatibleTextRenderingDefault(False)
    WindowsFormsSettings.TrackWindowsAccentColor = DevExpress.Utils.DefaultBoolean.True
    Application.Run(New Form1())
End Sub

The following example demonstrates how to obtain the system accent color:

csharp
using System.Drawing;
using DevExpress.Utils.Drawing.Helpers;

Color systemAccentColor = NativeMethods.GetWindowsAccentColor();
vb
Imports System.Drawing
Imports DevExpress.Utils.Drawing.Helpers

Private systemAccentColor As Color = NativeMethods.GetWindowsAccentColor()

Custom Accent Color

Use the SetAccentColor method to specify a custom accent color (that takes priority over the system accent color).

The following example demonstrates how to reset the accent color:

csharp
DevExpress.XtraEditors.WindowsFormsSettings.SetAccentColor(System.Drawing.Color.Empty);
vb
DevExpress.XtraEditors.WindowsFormsSettings.SetAccentColor(System.Drawing.Color.Empty)

Note

“The Bezier” skin supports the second accent color. Other skins do not support the second accent color.

Use the SetAccentColor2 method to specify the second accent color.

Tip

Read the following topic for information on how to display pre-designed Ribbon UI commands that correspond to advanced skin settings: Ribbon Skin Selectors.

See Also

SetAccentColor

SetAccentColor2

GetAccentColor()

GetAccentColor2()

WindowsFormsSettings Class

WindowsFormsSettings Members

DevExpress.XtraEditors Namespace