SystemColors SystemColors SystemColors SystemColors Class

定义

SystemColors 类的每个属性都是 Color 结构,这种结构是 Windows 显示元素的颜色。Each property of the SystemColors class is a Color structure that is the color of a Windows display element.

public ref class SystemColors sealed
public sealed class SystemColors
type SystemColors = class
Public NotInheritable Class SystemColors
继承
SystemColorsSystemColorsSystemColorsSystemColors

示例

下面的代码示例演示Equality运算符SystemColors和类。The following code example demonstrates the Equality operator and the SystemColors class. 此示例旨在与包含名为Button1的按钮的 Windows 窗体一起使用。This example is designed to be used with a Windows Form that contains a button named Button1. 将以下代码粘贴到窗体中, 并Button1_Click将该方法与按钮Click的事件关联。Paste the following code into your form and associate the Button1_Click method with the button's Click event.

void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   if ( this->BackColor == SystemColors::ControlDark )
   {
      this->BackColor = SystemColors::Control;
   }
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{

    if (this.BackColor == SystemColors.ControlDark)
    {
        this.BackColor = SystemColors.Control;
    }
}
Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

    If (Color.op_Equality(Me.BackColor, SystemColors.ControlDark)) Then
        Me.BackColor = SystemColors.Control
    End If
End Sub

注解

使用SystemPens SystemColorsSystemBrushes类的属性, 而不是基于中的值来创建新的笔或画笔, 从而提高性能。Better performance is achieved by using the properties of the SystemPens or SystemBrushes classes rather than creating a new pen or brush based on a value from SystemColors. 例如, 如果想要获取三维元素的面部颜色的画笔, 请使用SystemBrushes.Control属性, 因为它将获取已存在的画笔, 而SolidBrush调用具有参数值的SystemColors.Control构造函数将创建一个新的画笔。For example, if you wanted to get a brush for the face color of a 3-D element, use the SystemBrushes.Control property because it gets a brush that already exists, whereas calling the SolidBrush constructor with a parameter value of SystemColors.Control will create a new brush.

属性

ActiveBorder ActiveBorder ActiveBorder ActiveBorder

获取表示活动窗口边框的颜色的 Color 结构。Gets a Color structure that is the color of the active window's border.

ActiveCaption ActiveCaption ActiveCaption ActiveCaption

获取 Color 结构,它是活动窗口标题栏的背景色。Gets a Color structure that is the color of the background of the active window's title bar.

ActiveCaptionText ActiveCaptionText ActiveCaptionText ActiveCaptionText

获取一个 Color,它是活动窗口标题栏中文本的颜色。Gets a Color structure that is the color of the text in the active window's title bar.

AppWorkspace AppWorkspace AppWorkspace AppWorkspace

获取 Color 结构,它是应用程序工作区的颜色。Gets a Color structure that is the color of the application workspace.

ButtonFace ButtonFace ButtonFace ButtonFace

获取 Color 结构,它是三维元素的表面颜色。Gets a Color structure that is the face color of a 3-D element.

ButtonHighlight ButtonHighlight ButtonHighlight ButtonHighlight

获取 Color 结构,它是三维元素的突出显示颜色。Gets a Color structure that is the highlight color of a 3-D element.

ButtonShadow ButtonShadow ButtonShadow ButtonShadow

获取 Color 结构,它是三维元素的阴影颜色。Gets a Color structure that is the shadow color of a 3-D element.

Control Control Control Control

获取 Color 结构,它是三维元素的表面颜色。Gets a Color structure that is the face color of a 3-D element.

ControlDark ControlDark ControlDark ControlDark

获取 Color 结构,它是三维元素的阴影颜色。Gets a Color structure that is the shadow color of a 3-D element.

ControlDarkDark ControlDarkDark ControlDarkDark ControlDarkDark

获取 Color 结构,它是三维元素的暗阴影颜色。Gets a Color structure that is the dark shadow color of a 3-D element.

ControlLight ControlLight ControlLight ControlLight

获取 Color 结构,它是三维元素的亮色。Gets a Color structure that is the light color of a 3-D element.

ControlLightLight ControlLightLight ControlLightLight ControlLightLight

获取 Color 结构,它是三维元素的突出显示颜色。Gets a Color structure that is the highlight color of a 3-D element.

ControlText ControlText ControlText ControlText

获取 Color 结构,它是三维元素中的文本颜色。Gets a Color structure that is the color of text in a 3-D element.

Desktop Desktop Desktop Desktop

获取 Color 结构,它是桌面的颜色。Gets a Color structure that is the color of the desktop.

GradientActiveCaption GradientActiveCaption GradientActiveCaption GradientActiveCaption

获取 Color 结构,它是活动窗口标题栏的颜色渐变中的最亮色。Gets a Color structure that is the lightest color in the color gradient of an active window's title bar.

GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption GradientInactiveCaption

获取 Color 结构,它是非活动窗口标题栏的颜色渐变中的最亮色。Gets a Color structure that is the lightest color in the color gradient of an inactive window's title bar.

GrayText GrayText GrayText GrayText

获取 Color 结构,它是浅灰色文本的颜色。Gets a Color structure that is the color of dimmed text.

Highlight Highlight Highlight Highlight

获取 Color 结构,它是选定项的背景色。Gets a Color structure that is the color of the background of selected items.

HighlightText HighlightText HighlightText HighlightText

获取 Color 结构,它是选定项的文本颜色。Gets a Color structure that is the color of the text of selected items.

HotTrack HotTrack HotTrack HotTrack

获取 Color 结构,它是用于指定热跟踪项的颜色。Gets a Color structure that is the color used to designate a hot-tracked item.

InactiveBorder InactiveBorder InactiveBorder InactiveBorder

获取 Color 结构,它是非活动窗口的边框颜色。Gets a Color structure that is the color of an inactive window's border.

InactiveCaption InactiveCaption InactiveCaption InactiveCaption

获取 Color 结构,它是非活动窗口的标题栏的背景色。Gets a Color structure that is the color of the background of an inactive window's title bar.

InactiveCaptionText InactiveCaptionText InactiveCaptionText InactiveCaptionText

获取 Color 结构,它是非活动窗口的标题栏中的文本颜色。Gets a Color structure that is the color of the text in an inactive window's title bar.

Info Info Info Info

获取 Color 结构,它是工具提示的背景色。Gets a Color structure that is the color of the background of a ToolTip.

InfoText InfoText InfoText InfoText

获取 Color 结构,它是工具提示文本的颜色。Gets a Color structure that is the color of the text of a ToolTip.

Menu Menu Menu Menu

获取 Color 结构,它是菜单的背景色。Gets a Color structure that is the color of a menu's background.

MenuBar MenuBar MenuBar MenuBar

获取 Color 结构,它是菜单栏的背景色。Gets a Color structure that is the color of the background of a menu bar.

MenuHighlight MenuHighlight MenuHighlight MenuHighlight

获取 Color 结构,它是当菜单显示为平面菜单时用于突出显示菜单项的颜色。Gets a Color structure that is the color used to highlight menu items when the menu appears as a flat menu.

MenuText MenuText MenuText MenuText

获取 Color 结构,它是菜单文本的颜色。Gets a Color structure that is the color of a menu's text.

ScrollBar ScrollBar ScrollBar ScrollBar

获取 Color 结构,它是滚动条的背景色。Gets a Color structure that is the color of the background of a scroll bar.

Window Window Window Window

获取 Color 结构,它是窗口工作区中的背景色。Gets a Color structure that is the color of the background in the client area of a window.

WindowFrame WindowFrame WindowFrame WindowFrame

获取 Color 结构,它是窗口框架的颜色。Gets a Color structure that is the color of a window frame.

WindowText WindowText WindowText WindowText

获取 Color 结构,它是窗口工作区文本的颜色。Gets a Color structure that is the color of the text in the client area of a window.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于