RadioButtonRenderer.DrawRadioButton Metoda

Definice

Nakreslí ovládací prvek přepínače (označuje se také jako přepínač).

Přetížení

Name Description
DrawRadioButton(Graphics, Point, RadioButtonState)

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění.

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

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a s volitelným obdélníkem fokusu.

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

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a formátováním textu a s volitelným obdélníkem fokusu.

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

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a obrázkem a s volitelným obdélníkem fokusu.

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

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění; se zadaným textem, formátováním textu a obrázkem; a s volitelným obdélníkem fokusu.

DrawRadioButton(Graphics, Point, RadioButtonState)

Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění.

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)

Parametry

g
Graphics

Používá Graphics se k vykreslení přepínače.

glyphLocation
Point

Nakreslete Point tlačítko možnosti glyph at.

state
RadioButtonState

Jedna z RadioButtonState hodnot, které určují vizuální stav tlačítka možnosti.

Poznámky

Pokud jsou v operačním systému povoleny styly vizuálů a styly vizuálů se použijí pro aktuální aplikaci, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. V opačném případě tato metoda nakreslí přepínač s klasickým stylem Windows.

Platí pro

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

Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a s volitelným obdélníkem fokusu.

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)

Parametry

g
Graphics

Používá Graphics se k vykreslení přepínače.

glyphLocation
Point

Nakreslete Point tlačítko možnosti glyph at.

textBounds
Rectangle

Nakreslení RectangleradioButtonText .

radioButtonText
String

Nakreslení String pomocí přepínače

font
Font

To Font platí pro radioButtonText.

focused
Boolean

truenakreslit obdélník fokusu; v opačném případě . false

state
RadioButtonState

Jedna z RadioButtonState hodnot, které určují vizuální stav tlačítka možnosti.

Příklady

Následující příklad kódu používá metodu DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) v metodě vlastního ovládacího prvku OnPaint k vykreslení tlačítka možnosti ve stavu určeném umístěním ukazatele myši. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu RadioButtonRenderer.

    // 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

Poznámky

Pokud jsou v operačním systému povoleny styly vizuálů a styly vizuálů se použijí pro aktuální aplikaci, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. V opačném případě tato metoda nakreslí přepínač s klasickým stylem Windows.

Platí pro

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

Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a formátováním textu a s volitelným obdélníkem fokusu.

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)

Parametry

g
Graphics

Používá Graphics se k vykreslení přepínače.

glyphLocation
Point

Nakreslete Point tlačítko možnosti glyph at.

textBounds
Rectangle

Nakreslení RectangleradioButtonText .

radioButtonText
String

Nakreslení String pomocí přepínače

font
Font

To Font platí pro radioButtonText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

focused
Boolean

truenakreslit obdélník fokusu; v opačném případě . false

state
RadioButtonState

Jedna z RadioButtonState hodnot, které určují vizuální stav tlačítka možnosti.

Poznámky

Pokud jsou v operačním systému povoleny styly vizuálů a styly vizuálů se použijí pro aktuální aplikaci, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. V opačném případě tato metoda nakreslí přepínač s klasickým stylem Windows.

Platí pro

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

Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění, se zadaným textem a obrázkem a s volitelným obdélníkem fokusu.

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)

Parametry

g
Graphics

Používá Graphics se k vykreslení přepínače.

glyphLocation
Point

Nakreslete Point tlačítko možnosti glyph at.

textBounds
Rectangle

Nakreslení RectangleradioButtonText .

radioButtonText
String

Nakreslení String pomocí přepínače

font
Font

To Font platí pro radioButtonText.

image
Image

Nakreslení Image pomocí přepínače

imageBounds
Rectangle

Nakreslení Rectangleimage .

focused
Boolean

truenakreslit obdélník fokusu; v opačném případě . false

state
RadioButtonState

Jedna z RadioButtonState hodnot, které určují vizuální stav tlačítka možnosti.

Poznámky

Pokud jsou v operačním systému povoleny styly vizuálů a styly vizuálů se použijí pro aktuální aplikaci, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. V opačném případě tato metoda nakreslí přepínač s klasickým stylem Windows.

Platí pro

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

Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs
Zdroj:
RadioButtonRenderer.cs

Nakreslí ovládací prvek přepínače (označovaný také jako přepínač) v zadaném stavu a umístění; se zadaným textem, formátováním textu a obrázkem; a s volitelným obdélníkem fokusu.

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)

Parametry

g
Graphics

Používá Graphics se k vykreslení přepínače.

glyphLocation
Point

Nakreslete Point tlačítko možnosti glyph at.

textBounds
Rectangle

Nakreslení RectangleradioButtonText .

radioButtonText
String

Nakreslení String pomocí přepínače

font
Font

To Font platí pro radioButtonText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

image
Image

Nakreslení Image pomocí přepínače

imageBounds
Rectangle

Nakreslení Rectangleimage .

focused
Boolean

truenakreslit obdélník fokusu; v opačném případě . false

state
RadioButtonState

Jedna z RadioButtonState hodnot, které určují vizuální stav tlačítka možnosti.

Poznámky

Pokud jsou v operačním systému povoleny styly vizuálů a styly vizuálů se použijí pro aktuální aplikaci, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. V opačném případě tato metoda nakreslí přepínač s klasickým stylem Windows.

Platí pro