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

範例

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

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 都會 VisualStyleElement 針對選項按鈕控制項的不同狀態傳回 。

屬性

CheckedDisabled

取得視覺化樣式項目,表示處於核取狀態的停用選項按鈕。

CheckedHot

取得視覺化樣式項目,表示處於核取狀態的作用中選項按鈕。

CheckedNormal

取得視覺化樣式項目,表示處於核取狀態的一般選項按鈕。

CheckedPressed

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

UncheckedDisabled

取得視覺化樣式項目,表示處於未核取狀態的停用選項按鈕。

UncheckedHot

取得視覺化樣式項目,表示處於未核取狀態的作用中選項按鈕。

UncheckedNormal

取得視覺化樣式項目,表示處於未核取狀態的一般選項按鈕。

UncheckedPressed

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

適用於

另請參閱