RadioButtonRenderer.DrawRadioButton Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Desenha um botão de opção (também conhecido como botão de acesso).
Sobrecargas
| Name | Description |
|---|---|
| DrawRadioButton(Graphics, Point, RadioButtonState) |
Desenha um controlo de botão de opção (também conhecido como botão de rádio) no estado e localização especificados. |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) |
Desenha um controlo de botão de opção (também conhecido como botão de rádio) no estado e localização especificados, com o texto especificado e com um retângulo de foco opcional. |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, RadioButtonState) |
Desenha um controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização especificados; com o texto especificado, a formatação do texto e a imagem; 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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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
- state
- RadioButtonState
Um dos RadioButtonState valores que especifica o estado visual do botão de opção.
Observações
Se os estilos visuais estiverem ativados no sistema operativo e aplicados estilos visuais à aplicação atual, este método desenhará o botão de opção com o estilo visual atual. Caso contrário, este método desenhará o botão de opção com o estilo clássico do Windows.
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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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
- focused
- Boolean
true 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 seguinte utiliza o DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) método de um controlo OnPaint personalizado para desenhar um botão de opção no estado determinado pela localização do ponteiro do rato. 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
Observações
Se os estilos visuais estiverem ativados no sistema operativo e aplicados estilos visuais à aplicação atual, este método desenhará o botão de opção com o estilo visual atual. Caso contrário, este método desenhará o botão de opção com o estilo clássico do Windows.
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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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
- flags
- TextFormatFlags
Uma combinação bit a bit dos TextFormatFlags valores.
- focused
- Boolean
true 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.
Observações
Se os estilos visuais estiverem ativados no sistema operativo e aplicados estilos visuais à aplicação atual, este método desenhará o botão de opção com o estilo visual atual. Caso contrário, este método desenhará o botão de opção com o estilo clássico do Windows.
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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização 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
- focused
- Boolean
true 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.
Observações
Se os estilos visuais estiverem ativados no sistema operativo e aplicados estilos visuais à aplicação atual, este método desenhará o botão de opção com o estilo visual atual. Caso contrário, este método desenhará o botão de opção com o estilo clássico do Windows.
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 controlo de botão de opção (também conhecido como botão de rádio) no estado e localização especificados; com o texto especificado, a formatação do texto e a imagem; 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
- flags
- TextFormatFlags
Uma combinação bit a bit dos TextFormatFlags valores.
- focused
- Boolean
true 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.
Observações
Se os estilos visuais estiverem ativados no sistema operativo e aplicados estilos visuais à aplicação atual, este método desenhará o botão de opção com o estilo visual atual. Caso contrário, este método desenhará o botão de opção com o estilo clássico do Windows.