RadioButtonRenderer.DrawRadioButton Methode

Definition

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet).

Überlädt

Name Beschreibung
DrawRadioButton(Graphics, Point, RadioButtonState)

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position.

DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState)

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position mit dem angegebenen Text und mit einem optionalen Fokusrechteck.

DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, RadioButtonState)

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position, mit der angegebenen Text- und Textformatierung und mit einem optionalen Fokusrechteck.

DrawRadioButton(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, RadioButtonState)

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position mit dem angegebenen Text und Bild sowie mit einem optionalen Fokusrechteck.

DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, RadioButtonState)

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position; mit dem angegebenen Text, der Textformatierung und dem Bild; und mit einem optionalen Fokusrechteck.

DrawRadioButton(Graphics, Point, RadioButtonState)

Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position.

public:
 static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, state As RadioButtonState)

Parameter

g
Graphics

Die Graphics zum Zeichnen der Optionsschaltfläche verwendete Schaltfläche.

glyphLocation
Point

Zum Point Zeichnen der Optionsschaltfläche Glyphe

state
RadioButtonState

Einer der RadioButtonState Werte, der den visuellen Zustand der Optionsschaltfläche angibt.

Hinweise

Wenn visuelle Formatvorlagen im Betriebssystem aktiviert sind und visuelle Formatvorlagen auf die aktuelle Anwendung angewendet werden, zeichnet diese Methode die Optionsschaltfläche mit dem aktuellen visuellen Stil. Andernfalls zeichnet diese Methode die Optionsschaltfläche mit der klassischen Windows Formatvorlage.

Gilt für:

DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState)

Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position mit dem angegebenen Text und mit einem optionalen Fokusrechteck.

public:
 static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, focused As Boolean, state As RadioButtonState)

Parameter

g
Graphics

Die Graphics zum Zeichnen der Optionsschaltfläche verwendete Schaltfläche.

glyphLocation
Point

Zum Point Zeichnen der Optionsschaltfläche Glyphe

textBounds
Rectangle

Das Rectangle zu zeichnende radioButtonText Zeichen.

radioButtonText
String

Das String zu zeichnende Zeichen mit der Optionsschaltfläche.

font
Font

Der Font für radioButtonText.

focused
Boolean

trueum ein Fokusrechteck zu zeichnen; andernfalls . false

state
RadioButtonState

Einer der RadioButtonState Werte, der den visuellen Zustand der Optionsschaltfläche angibt.

Beispiele

Im folgenden Codebeispiel wird die Methode in der DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) Methode eines benutzerdefinierten Steuerelements verwendet, um eine Optionsschaltfläche im Zustand zu zeichnen, der durch die Position des Mauszeigers OnPaint bestimmt wird. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die RadioButtonRenderer Klasse bereitgestellt wird.

    // Draw the radio button in the current state.
protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        __super::OnPaint(e);

        RadioButtonRenderer::DrawRadioButton(e->Graphics,
            ClientRectangle.Location, TextRectangle, this->Text,
            this->Font, clicked, state);
    }

    // Draw the radio button in the checked or unchecked state.
protected:
    virtual void OnMouseDown(MouseEventArgs^ e) override
    {
        __super::OnMouseDown(e);

        if (!clicked)
        {
            clicked = true;
            this->Text = "Clicked!";
            state = RadioButtonState::CheckedPressed;
            Invalidate();
        }
        else
        {
            clicked = false;
            this->Text = "Click here";
            state = RadioButtonState::UncheckedNormal;
            Invalidate();
        }
    }
// Draw the radio button in the current state.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    RadioButtonRenderer.DrawRadioButton(e.Graphics,
        ClientRectangle.Location, TextRectangle, this.Text,
        this.Font, clicked, state);
}

// Draw the radio button in the checked or unchecked state.
protected override void OnMouseDown(MouseEventArgs e)
{
    base.OnMouseDown(e);

    if (!clicked)
    {
        clicked = true;
        this.Text = "Clicked!";
        state = RadioButtonState.CheckedPressed;
        Invalidate();
    }
    else
    {
        clicked = false;
        this.Text = "Click here";
        state = RadioButtonState.UncheckedNormal;
        Invalidate();
    }
}
' Draw the radio button in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)
    RadioButtonRenderer.DrawRadioButton(e.Graphics, _
        Me.ClientRectangle.Location, TextRectangle, Me.Text, _
        Me.Font, clicked, state)
End Sub

' Draw the radio button in the checked or unchecked state.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
    MyBase.OnMouseDown(e)

    If Not clicked Then
        clicked = True
        Me.Text = "Clicked!"
        state = RadioButtonState.CheckedPressed
        Invalidate()
    Else
        clicked = False
        Me.Text = "Click here"
        state = RadioButtonState.UncheckedNormal
        Invalidate()
    End If

End Sub

Hinweise

Wenn visuelle Formatvorlagen im Betriebssystem aktiviert sind und visuelle Formatvorlagen auf die aktuelle Anwendung angewendet werden, zeichnet diese Methode die Optionsschaltfläche mit dem aktuellen visuellen Stil. Andernfalls zeichnet diese Methode die Optionsschaltfläche mit der klassischen Windows Formatvorlage.

Gilt für:

DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, RadioButtonState)

Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position, mit der angegebenen Text- und Textformatierung und mit einem optionalen Fokusrechteck.

public:
 static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As RadioButtonState)

Parameter

g
Graphics

Die Graphics zum Zeichnen der Optionsschaltfläche verwendete Schaltfläche.

glyphLocation
Point

Zum Point Zeichnen der Optionsschaltfläche Glyphe

textBounds
Rectangle

Das Rectangle zu zeichnende radioButtonText Zeichen.

radioButtonText
String

Das String zu zeichnende Zeichen mit der Optionsschaltfläche.

font
Font

Der Font für radioButtonText.

flags
TextFormatFlags

Eine bitweise Kombination der TextFormatFlags Werte.

focused
Boolean

trueum ein Fokusrechteck zu zeichnen; andernfalls . false

state
RadioButtonState

Einer der RadioButtonState Werte, der den visuellen Zustand der Optionsschaltfläche angibt.

Hinweise

Wenn visuelle Formatvorlagen im Betriebssystem aktiviert sind und visuelle Formatvorlagen auf die aktuelle Anwendung angewendet werden, zeichnet diese Methode die Optionsschaltfläche mit dem aktuellen visuellen Stil. Andernfalls zeichnet diese Methode die Optionsschaltfläche mit der klassischen Windows Formatvorlage.

Gilt für:

DrawRadioButton(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, RadioButtonState)

Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position mit dem angegebenen Text und Bild sowie mit einem optionalen Fokusrechteck.

public:
 static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, image As Image, imageBounds As Rectangle, focused As Boolean, state As RadioButtonState)

Parameter

g
Graphics

Die Graphics zum Zeichnen der Optionsschaltfläche verwendete Schaltfläche.

glyphLocation
Point

Zum Point Zeichnen der Optionsschaltfläche Glyphe

textBounds
Rectangle

Das Rectangle zu zeichnende radioButtonText Zeichen.

radioButtonText
String

Das String zu zeichnende Zeichen mit der Optionsschaltfläche.

font
Font

Der Font für radioButtonText.

image
Image

Das Image zu zeichnende Zeichen mit der Optionsschaltfläche.

imageBounds
Rectangle

Das Rectangle zu zeichnende image Zeichen.

focused
Boolean

trueum ein Fokusrechteck zu zeichnen; andernfalls . false

state
RadioButtonState

Einer der RadioButtonState Werte, der den visuellen Zustand der Optionsschaltfläche angibt.

Hinweise

Wenn visuelle Formatvorlagen im Betriebssystem aktiviert sind und visuelle Formatvorlagen auf die aktuelle Anwendung angewendet werden, zeichnet diese Methode die Optionsschaltfläche mit dem aktuellen visuellen Stil. Andernfalls zeichnet diese Methode die Optionsschaltfläche mit der klassischen Windows Formatvorlage.

Gilt für:

DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, RadioButtonState)

Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs
Quelle:
RadioButtonRenderer.cs

Zeichnet ein Optionsfeld-Steuerelement (auch als Optionsfeld bezeichnet) im angegebenen Zustand und an der angegebenen Position; mit dem angegebenen Text, der Textformatierung und dem Bild; und mit einem optionalen Fokusrechteck.

public:
 static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, flags As TextFormatFlags, image As Image, imageBounds As Rectangle, focused As Boolean, state As RadioButtonState)

Parameter

g
Graphics

Die Graphics zum Zeichnen der Optionsschaltfläche verwendete Schaltfläche.

glyphLocation
Point

Zum Point Zeichnen der Optionsschaltfläche Glyphe

textBounds
Rectangle

Das Rectangle zu zeichnende radioButtonText Zeichen.

radioButtonText
String

Das String zu zeichnende Zeichen mit der Optionsschaltfläche.

font
Font

Der Font für radioButtonText.

flags
TextFormatFlags

Eine bitweise Kombination der TextFormatFlags Werte.

image
Image

Das Image zu zeichnende Zeichen mit der Optionsschaltfläche.

imageBounds
Rectangle

Das Rectangle zu zeichnende image Zeichen.

focused
Boolean

trueum ein Fokusrechteck zu zeichnen; andernfalls . false

state
RadioButtonState

Einer der RadioButtonState Werte, der den visuellen Zustand der Optionsschaltfläche angibt.

Hinweise

Wenn visuelle Formatvorlagen im Betriebssystem aktiviert sind und visuelle Formatvorlagen auf die aktuelle Anwendung angewendet werden, zeichnet diese Methode die Optionsschaltfläche mit dem aktuellen visuellen Stil. Andernfalls zeichnet diese Methode die Optionsschaltfläche mit der klassischen Windows Formatvorlage.

Gilt für: