RadioButtonRenderer.DrawRadioButton Método

Definição

Desenha um controle de botão de opção (também conhecido como botão de opção).

Sobrecargas

Nome Description
DrawRadioButton(Graphics, Point, RadioButtonState)

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados.

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

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto especificado e com um retângulo de foco opcional.

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

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto e a formatação de texto especificados e com um retângulo de foco opcional.

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

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto e a imagem especificados e com um retângulo de foco opcional.

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

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados; com o texto, a formatação de texto e a imagem especificados; e com um retângulo de foco opcional.

DrawRadioButton(Graphics, Point, RadioButtonState)

Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados.

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)

Parâmetros

g
Graphics

O Graphics usado para desenhar o botão de opção.

glyphLocation
Point

O Point glifo do botão para desenhar a opção.

state
RadioButtonState

Um dos RadioButtonState valores que especifica o estado visual do botão de opção.

Comentários

Se os estilos visuais estiverem habilitados no sistema operacional e os estilos visuais forem aplicados ao aplicativo atual, esse método desenhará o botão de opção com o estilo visual atual. Caso contrário, esse método desenhará o botão de opção com o estilo de Windows clássico.

Aplica-se a

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

Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto especificado e com um retângulo de foco opcional.

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)

Parâmetros

g
Graphics

O Graphics usado para desenhar o botão de opção.

glyphLocation
Point

O Point glifo do botão para desenhar a opção.

textBounds
Rectangle

O Rectangle para desenhar radioButtonText .

radioButtonText
String

O String botão desenhar com a opção.

font
Font

O Font a ser aplicado a radioButtonText.

focused
Boolean

true para desenhar um retângulo de foco; caso contrário, false.

state
RadioButtonState

Um dos RadioButtonState valores que especifica o estado visual do botão de opção.

Exemplos

O exemplo de código a seguir usa o DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) método em um método de OnPaint controle personalizado para desenhar um botão de opção no estado determinado pelo local do ponteiro do mouse. Este exemplo de código faz parte de um exemplo maior fornecido para a RadioButtonRenderer classe.

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

Comentários

Se os estilos visuais estiverem habilitados no sistema operacional e os estilos visuais forem aplicados ao aplicativo atual, esse método desenhará o botão de opção com o estilo visual atual. Caso contrário, esse método desenhará o botão de opção com o estilo de Windows clássico.

Aplica-se a

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

Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto e a formatação de texto especificados e com um retângulo de foco opcional.

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)

Parâmetros

g
Graphics

O Graphics usado para desenhar o botão de opção.

glyphLocation
Point

O Point glifo do botão para desenhar a opção.

textBounds
Rectangle

O Rectangle para desenhar radioButtonText .

radioButtonText
String

O String botão desenhar com a opção.

font
Font

O Font a ser aplicado a radioButtonText.

flags
TextFormatFlags

Uma combinação bit a bit dos TextFormatFlags valores.

focused
Boolean

true para desenhar um retângulo de foco; caso contrário, false.

state
RadioButtonState

Um dos RadioButtonState valores que especifica o estado visual do botão de opção.

Comentários

Se os estilos visuais estiverem habilitados no sistema operacional e os estilos visuais forem aplicados ao aplicativo atual, esse método desenhará o botão de opção com o estilo visual atual. Caso contrário, esse método desenhará o botão de opção com o estilo de Windows clássico.

Aplica-se a

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

Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados, com o texto e a imagem especificados e com um retângulo de foco opcional.

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)

Parâmetros

g
Graphics

O Graphics usado para desenhar o botão de opção.

glyphLocation
Point

O Point glifo do botão para desenhar a opção.

textBounds
Rectangle

O Rectangle para desenhar radioButtonText .

radioButtonText
String

O String botão desenhar com a opção.

font
Font

O Font a ser aplicado a radioButtonText.

image
Image

O Image botão desenhar com a opção.

imageBounds
Rectangle

O Rectangle para desenhar image .

focused
Boolean

true para desenhar um retângulo de foco; caso contrário, false.

state
RadioButtonState

Um dos RadioButtonState valores que especifica o estado visual do botão de opção.

Comentários

Se os estilos visuais estiverem habilitados no sistema operacional e os estilos visuais forem aplicados ao aplicativo atual, esse método desenhará o botão de opção com o estilo visual atual. Caso contrário, esse método desenhará o botão de opção com o estilo de Windows clássico.

Aplica-se a

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

Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs
Origem:
RadioButtonRenderer.cs

Desenha um controle de botão de opção (também conhecido como botão de opção) no estado e local especificados; com o texto, a formatação de texto e a imagem especificados; e com um retângulo de foco opcional.

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)

Parâmetros

g
Graphics

O Graphics usado para desenhar o botão de opção.

glyphLocation
Point

O Point glifo do botão para desenhar a opção.

textBounds
Rectangle

O Rectangle para desenhar radioButtonText .

radioButtonText
String

O String botão desenhar com a opção.

font
Font

O Font a ser aplicado a radioButtonText.

flags
TextFormatFlags

Uma combinação bit a bit dos TextFormatFlags valores.

image
Image

O Image botão desenhar com a opção.

imageBounds
Rectangle

O Rectangle para desenhar image .

focused
Boolean

true para desenhar um retângulo de foco; caso contrário, false.

state
RadioButtonState

Um dos RadioButtonState valores que especifica o estado visual do botão de opção.

Comentários

Se os estilos visuais estiverem habilitados no sistema operacional e os estilos visuais forem aplicados ao aplicativo atual, esse método desenhará o botão de opção com o estilo visual atual. Caso contrário, esse método desenhará o botão de opção com o estilo de Windows clássico.

Aplica-se a