Прочетете на английски Редактиране

Споделяне чрез


SystemBrushes Class

Definition

Each property of the SystemBrushes class is a SolidBrush that is the color of a Windows display element.

C#
public static class SystemBrushes
C#
public sealed class SystemBrushes
Inheritance
SystemBrushes

Examples

The following code example shows how to set a keyboard shortcut using the HotkeyPrefix property. It also demonstrates how to use the FromSystemColor method. To run this example, paste the code into a form, handle the form's Paint event and call the following method, passing e as PaintEventArgs.

C#
private void ShowHotKey(PaintEventArgs e)
{

    // Declare the string with a keyboard shortcut.
    string text = "&Click Here";

    // Declare a new StringFormat.
    StringFormat format = new StringFormat();

    // Set the HotkeyPrefix property.
    format.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show;

    // Draw the string.
    Brush theBrush = 
        SystemBrushes.FromSystemColor(SystemColors.Highlight);

    e.Graphics.DrawString(text, this.Font, theBrush, 30, 40, format);
}

Remarks

Бележка

In .NET 6 and later versions, the System.Drawing.Common package, which includes this type, is only supported on Windows operating systems. Use of this type in cross-platform apps causes compile-time warnings and run-time exceptions. For more information, see System.Drawing.Common only supported on Windows.

Properties

ActiveBorder

Gets a SolidBrush that is the color of the active window's border.

ActiveCaption

Gets a SolidBrush that is the color of the background of the active window's title bar.

ActiveCaptionText

Gets a SolidBrush that is the color of the text in the active window's title bar.

AppWorkspace

Gets a SolidBrush that is the color of the application workspace.

ButtonFace

Gets a SolidBrush that is the face color of a 3-D element.

ButtonHighlight

Gets a SolidBrush that is the highlight color of a 3-D element.

ButtonShadow

Gets a SolidBrush that is the shadow color of a 3-D element.

Control

Gets a SolidBrush that is the face color of a 3-D element.

ControlDark

Gets a SolidBrush that is the shadow color of a 3-D element.

ControlDarkDark

Gets a SolidBrush that is the dark shadow color of a 3-D element.

ControlLight

Gets a SolidBrush that is the light color of a 3-D element.

ControlLightLight

Gets a SolidBrush that is the highlight color of a 3-D element.

ControlText

Gets a SolidBrush that is the color of text in a 3-D element.

Desktop

Gets a SolidBrush that is the color of the desktop.

GradientActiveCaption

Gets a SolidBrush that is the lightest color in the color gradient of an active window's title bar.

GradientInactiveCaption

Gets a SolidBrush that is the lightest color in the color gradient of an inactive window's title bar.

GrayText

Gets a SolidBrush that is the color of dimmed text.

Highlight

Gets a SolidBrush that is the color of the background of selected items.

HighlightText

Gets a SolidBrush that is the color of the text of selected items.

HotTrack

Gets a SolidBrush that is the color used to designate a hot-tracked item.

InactiveBorder

Gets a SolidBrush that is the color of an inactive window's border.

InactiveCaption

Gets a SolidBrush that is the color of the background of an inactive window's title bar.

InactiveCaptionText

Gets a SolidBrush that is the color of the text in an inactive window's title bar.

Info

Gets a SolidBrush that is the color of the background of a ToolTip.

InfoText

Gets a SolidBrush that is the color of the text of a ToolTip.

Menu

Gets a SolidBrush that is the color of a menu's background.

MenuBar

Gets a SolidBrush that is the color of the background of a menu bar.

MenuHighlight

Gets a SolidBrush that is the color used to highlight menu items when the menu appears as a flat menu.

MenuText

Gets a SolidBrush that is the color of a menu's text.

ScrollBar

Gets a SolidBrush that is the color of the background of a scroll bar.

Window

Gets a SolidBrush that is the color of the background in the client area of a window.

WindowFrame

Gets a SolidBrush that is the color of a window frame.

WindowText

Gets a SolidBrush that is the color of the text in the client area of a window.

Methods

FromSystemColor(Color)

Creates a Brush from the specified Color structure.

Applies to

Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10