通过


VisualStyleElement.Button.GroupBox 类

定义

为组框控件的不同状态提供 VisualStyleElement 对象。 无法继承此类。

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

示例

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

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

属性

名称 说明
Disabled

获取表示禁用的分组框的视觉样式元素。

Normal

获取表示普通分组框的视觉样式元素。

适用于

另请参阅