VisualStyleElement.Button.CheckBox 类     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为复选框控件的不同状态提供 VisualStyleElement 对象。 此类不能被继承。
public: ref class VisualStyleElement::Button::CheckBox abstract sealedpublic static class VisualStyleElement.Button.CheckBoxtype VisualStyleElement.Button.CheckBox = classPublic Class VisualStyleElement.Button.CheckBox- 继承
- 
				VisualStyleElement.Button.CheckBox
示例
下面的代码示例演示如何使用 VisualStyleElement 属性返回的 VisualStyleElement.Button.CheckBox 创建 VisualStyleRenderer 。 若要运行此示例,请将其粘贴到 Windows 窗体中。 处理窗体的 Paint 事件,并从Paint事件处理方法调用 DrawVisualStyleElement_Button_CheckBox1 方法,作为 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的每个属性VisualStyleElement.Button.CheckBox返回检查框控件的不同状态的 。
属性
| CheckedDisabled | 获取表示处于选中状态的已禁用复选框的视觉样式元素。 | 
| CheckedHot | 获取表示处于选中状态的热复选框的视觉样式元素。 | 
| CheckedNormal | 获取表示处于选中状态的正常复选框的视觉样式元素。 | 
| CheckedPressed | 获取表示处于选中状态的已按下复选框的视觉样式元素。 | 
| MixedDisabled | 获取表示处于不确定状态的已禁用复选框的视觉样式元素。 | 
| MixedHot | 获取表示处于不确定状态的热复选框的视觉样式元素。 | 
| MixedNormal | 获取表示处于不确定状态的正常复选框的视觉样式元素。 | 
| MixedPressed | 获取表示处于不确定状态的已按下复选框的视觉样式元素。 | 
| UncheckedDisabled | 获取表示处于未选中状态的已禁用复选框的视觉样式元素。 | 
| UncheckedHot | 获取表示处于未选中状态的热复选框的视觉样式元素。 | 
| UncheckedNormal | 获取表示处于未选中状态的正常复选框的视觉样式元素。 | 
| UncheckedPressed | 获取表示处于未选中状态的已按下复选框的视觉样式元素。 |