VisualStyleElement.Button.CheckBox 类

定义

为复选框控件的不同状态提供 VisualStyleElement 对象。 此类不能被继承。

public: ref class VisualStyleElement::Button::CheckBox abstract sealed
public static class VisualStyleElement.Button.CheckBox
type VisualStyleElement.Button.CheckBox = class
Public Class VisualStyleElement.Button.CheckBox
继承
VisualStyleElement.Button.CheckBox

示例

下面的代码示例演示如何使用属性返回VisualStyleRenderer的值创建 a。VisualStyleElementVisualStyleElement.Button.CheckBox 若要运行此示例,请将其粘贴到 Windows 窗体中。 处理表单 Paint 的事件,并从事件处理方法调用 DrawVisualStyleElement_Button_CheckBox1 该方法 Paint ,并传递 ePaintEventArgs

public void DrawVisualStyleElement_Button_CheckBox1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.Button.CheckBox.UncheckedNormal))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.UncheckedNormal);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.Button.CheckBox.UncheckedNormal",
             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 DrawVisualStyleElement_Button_CheckBox1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.Button.CheckBox.UncheckedNormal)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.Button.CheckBox.UncheckedNormal)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.Button.CheckBox.UncheckedNormal", _
          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.Button.CheckBox 属性返回 VisualStyleElement 复选框控件的不同状态。

属性

名称 说明
CheckedDisabled

获取表示处于选中状态的禁用复选框的视觉样式元素。

CheckedHot

获取表示处于选中状态的热复选框的视觉样式元素。

CheckedNormal

获取表示处于选中状态的普通复选框的视觉样式元素。

CheckedPressed

获取表示处于选中状态的按下复选框的视觉样式元素。

MixedDisabled

获取表示处于不确定状态的禁用复选框的视觉样式元素。

MixedHot

获取表示处于不确定状态的热复选框的视觉样式元素。

MixedNormal

获取表示处于不确定状态的普通复选框的视觉样式元素。

MixedPressed

获取表示处于不确定状态的按下复选框的视觉样式元素。

UncheckedDisabled

获取表示处于未选中状态的禁用复选框的视觉样式元素。

UncheckedHot

获取表示处于未选中状态的热复选框的视觉样式元素。

UncheckedNormal

获取表示处于未选中状态的普通复选框的视觉样式元素。

UncheckedPressed

获取表示处于未选中状态的按下复选框的视觉样式元素。

适用于

另请参阅