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

範例

下列程式碼範例示範如何使用 屬性所傳回的 VisualStyleElement.Button.CheckBox 建立 VisualStyleElementVisualStyleRenderer 。 若要執行此範例,請將它貼到 Windows Form 中。 處理表單的事件 Paint ,並從事件處理方法呼叫 DrawVisualStyleElement_Button_CheckBox1 方法 Paint ,並 e 傳遞為 PaintEventArgs

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

取得視覺化樣式項目,表示處於未核取狀態的已按下核取方塊。

適用於

另請參閱