VisualStyleElement.Window.SysButton 类

定义

为窗口的“系统”按钮的每种状态提供 VisualStyleElement 对象。 此类不能被继承。

public: ref class VisualStyleElement::Window::SysButton abstract sealed
public static class VisualStyleElement.Window.SysButton
type VisualStyleElement.Window.SysButton = class
Public Class VisualStyleElement.Window.SysButton
继承
VisualStyleElement.Window.SysButton

示例

下面的代码示例演示如何使用 VisualStyleElement 属性返回的 Normal 创建 VisualStyleRenderer 。 若要运行此示例,请将其粘贴到 Windows 窗体中。 处理窗体的事件Paint,并从Paint事件处理方法调用 DrawVisualStyleElementWindowSysButton1 方法,作为 ePaintEventArgs传递。

public void DrawVisualStyleElementWindowSysButton1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.Window.SysButton.Normal))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.Window.SysButton.Normal);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.Window.SysButton.Normal",
             this.Font, Brushes.Black, new Point(10, 10));
    }
    else
        e.Graphics.DrawString("This element is not defined in the current visual style.",
             this.Font, Brushes.Black, new Point(10, 10));
}
Public Sub DrawVisualStyleElementWindowSysButton1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.Window.SysButton.Normal)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.Window.SysButton.Normal)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.Window.SysButton.Normal", _
          Me.Font, Brushes.Black, New Point(10, 10))
    Else
        e.Graphics.DrawString("This element is not defined in the current visual style.", _
          Me.Font, Brushes.Black, New Point(10, 10))
    End If
End Sub

注解

类的每个属性VisualStyleElement.Window.SysButton都会为“系统”按钮的不同状态返回 VisualStyleElement 。 单击时,此按钮将打开 “窗口 ”菜单 (也称为 “系统 ”菜单或“ 控制 ”菜单) 。

属性

Disabled

获取表示处于禁用状态的“系统”按钮的视觉样式元素

Hot

获取表示处于热状态的“系统”按钮的视觉样式元素

Normal

获取表示处于正常状态的“系统”按钮的视觉样式元素

Pressed

获取表示处于按下状态的“系统”按钮的视觉样式元素

适用于

另请参阅