VisualStyleElement.Button.RadioButton 類別

定義

提供 VisualStyleElement 不同狀態的物件,用於選擇按鈕控制。 此類別無法獲得繼承。

public: ref class VisualStyleElement::Button::RadioButton abstract sealed
public static class VisualStyleElement.Button.RadioButton
type VisualStyleElement.Button.RadioButton = class
Public Class VisualStyleElement.Button.RadioButton
繼承
VisualStyleElement.Button.RadioButton

範例

以下程式碼範例示範如何用屬性VisualStyleRenderer回傳VisualStyleElement的 來建立 aVisualStyleElement.Button.RadioButton。 要執行這個範例,請將它貼到 Windows 表單中。 處理表單的Paint事件,並從DrawVisualStyleElement_Button_RadioButton1事件處理方法呼叫該Paint方法,傳遞ePaintEventArgs

public void DrawVisualStyleElement_Button_RadioButton1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.Button.RadioButton.UncheckedNormal))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.UncheckedNormal);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.Button.RadioButton.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_RadioButton1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.Button.RadioButton.UncheckedNormal)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.Button.RadioButton.UncheckedNormal)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.Button.RadioButton.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.RadioButton 每個屬性會回傳 a VisualStyleElement 以表示選擇按鈕控制的不同狀態。

屬性

名稱 Description
CheckedDisabled

會獲得一個視覺樣式元素,代表在勾選狀態下被禁用的單選按鈕。

CheckedHot

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

CheckedNormal

會獲得一個視覺樣式元素,代表在勾選狀態下的一般單選按鈕。

CheckedPressed

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

UncheckedDisabled

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

UncheckedHot

會有一個視覺風格元素,代表未勾選狀態下的熱按鈕。

UncheckedNormal

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

UncheckedPressed

會獲得一個視覺樣式元素,代表在未勾選狀態下按下的單選鍵。

適用於

另請參閱