Sdílet prostřednictvím


RadioButtonRenderer.DrawRadioButton Metoda

Definice

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

Přetížení

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)

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 nakreslení tlačítka možnosti.

glyphLocation
Point

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

state
RadioButtonState

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

Poznámky

Pokud jsou v operačním systému povoleny vizuální styly a vizuální styly se použijí u aktuální aplikace, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. Jinak tato metoda nakreslí tlačítko možnosti s klasickým stylem Windows.

Platí pro

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.

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 nakreslení tlačítka možnosti.

glyphLocation
Point

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

textBounds
Rectangle

Nakreslení Rectangle radioButtonText .

radioButtonText
String

Nakreslete String ho tlačítkem možnosti.

font
Font

Platí Font 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í stav vizuálu 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 nakreslení 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 zadaného RadioButtonRenderer pro třídu.

    // 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 vizuální styly a vizuální styly se použijí u aktuální aplikace, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. Jinak tato metoda nakreslí tlačítko možnosti s klasickým stylem Windows.

Platí pro

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.

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 nakreslení tlačítka možnosti.

glyphLocation
Point

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

textBounds
Rectangle

Nakreslení Rectangle radioButtonText .

radioButtonText
String

Nakreslete String ho tlačítkem možnosti.

font
Font

Platí Font 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í stav vizuálu tlačítka možnosti.

Poznámky

Pokud jsou v operačním systému povoleny vizuální styly a vizuální styly se použijí u aktuální aplikace, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. Jinak tato metoda nakreslí tlačítko možnosti s klasickým stylem Windows.

Platí pro

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.

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 nakreslení tlačítka možnosti.

glyphLocation
Point

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

textBounds
Rectangle

Nakreslení Rectangle radioButtonText .

radioButtonText
String

Nakreslete String ho tlačítkem možnosti.

font
Font

Platí Font pro radioButtonText.

image
Image

Nakreslete Image ho tlačítkem možnosti.

imageBounds
Rectangle

Nakreslení Rectangle image .

focused
Boolean

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

state
RadioButtonState

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

Poznámky

Pokud jsou v operačním systému povoleny vizuální styly a vizuální styly se použijí u aktuální aplikace, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. Jinak tato metoda nakreslí tlačítko možnosti s klasickým stylem Windows.

Platí pro

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.

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 nakreslení tlačítka možnosti.

glyphLocation
Point

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

textBounds
Rectangle

Nakreslení Rectangle radioButtonText .

radioButtonText
String

Nakreslete String ho tlačítkem možnosti.

font
Font

Platí Font pro radioButtonText.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot.

image
Image

Nakreslete Image ho tlačítkem možnosti.

imageBounds
Rectangle

Nakreslení Rectangle image .

focused
Boolean

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

state
RadioButtonState

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

Poznámky

Pokud jsou v operačním systému povoleny vizuální styly a vizuální styly se použijí u aktuální aplikace, tato metoda nakreslí tlačítko možnosti s aktuálním vizuálním stylem. Jinak tato metoda nakreslí tlačítko možnosti s klasickým stylem Windows.

Platí pro