語言

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回傳VisualStyleElement的 來建立 aVisualStyleElement.Button.CheckBox。 要執行這個範例,請將它貼到 Windows 表單中。 處理表單的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 每個屬性會回傳勾取框控制的不同狀態 a VisualStyleElement 。

屬性

名稱 Description
CheckedDisabled

會獲得一個視覺樣式元素,代表勾選狀態下的 disabled 勾選框。

CheckedHot

會獲得一個視覺風格元素,代表勾選狀態中的熱勾選框。

CheckedNormal

會獲得一個視覺樣式元素,代表勾選狀態下的正常勾選框。

CheckedPressed

會獲得一個視覺樣式元素,代表勾選狀態下的已按下勾選框。

MixedDisabled

會獲得一個視覺樣式元素,代表在不確定狀態下被停用的勾選框。

MixedHot

取得一個視覺風格元素,代表不確定狀態中的熱勾選框。

MixedNormal

會獲得一個視覺樣式元素,代表不確定狀態下的正常勾選框。

MixedPressed

會獲得一個視覺樣式元素,代表在不確定狀態下按下的勾選框。

UncheckedDisabled

會獲得一個視覺風格元素,代表一個在未勾選狀態下的停用勾選框。

UncheckedHot

會獲得一個視覺樣式元素,代表未勾選狀態下的熱勾選框。

UncheckedNormal

會獲得一個視覺樣式元素,代表未勾選狀態下的正常勾選框。

UncheckedPressed

會獲得一個視覺風格元素,代表在未勾選狀態下按下的勾選框。

適用於

另請參閱