RadioButtonRenderer.GetGlyphSize(Graphics, RadioButtonState) Método

Definición

Devuelve el tamaño (en píxeles) del glifo del botón de opción (también denominado botón de radio).

public:
 static System::Drawing::Size GetGlyphSize(System::Drawing::Graphics ^ g, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static System.Drawing.Size GetGlyphSize (System.Drawing.Graphics g, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member GetGlyphSize : System.Drawing.Graphics * System.Windows.Forms.VisualStyles.RadioButtonState -> System.Drawing.Size
Public Shared Function GetGlyphSize (g As Graphics, state As RadioButtonState) As Size

Parámetros

g
Graphics

Objeto Graphics que se utiliza para dibujar el botón de opción.

state
RadioButtonState

Uno de los valores de RadioButtonState, que especifica el estado visual del botón de opción.

Devoluciones

Size

Estructura Size que representa el tamaño (en píxeles) del glifo del botón de opción.

Ejemplos

En el ejemplo de código siguiente se usa el GetGlyphSize método para determinar los límites del texto del botón de opción. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la RadioButtonRenderer clase .

    // Define the text bounds so that the text rectangle
    // does not include the radio button.
public:
    property Rectangle TextRectangle
    {
        Rectangle get()
        {
            Graphics^ g = this->CreateGraphics();

            textRectangleValue.X = ClientRectangle.X +
                RadioButtonRenderer::GetGlyphSize(g,
                RadioButtonState::UncheckedNormal).Width;
            textRectangleValue.Y = ClientRectangle.Y;
            textRectangleValue.Width = ClientRectangle.Width -
                RadioButtonRenderer::GetGlyphSize(g,
                RadioButtonState::UncheckedNormal).Width;
            textRectangleValue.Height = ClientRectangle.Height;
         
            delete g;                

            return textRectangleValue;
        }
    }
// Define the text bounds so that the text rectangle 
// does not include the radio button.
public Rectangle TextRectangle
{
    get
    {
        using (Graphics g = this.CreateGraphics())
        {
            textRectangleValue.X = ClientRectangle.X +
                RadioButtonRenderer.GetGlyphSize(g,
                RadioButtonState.UncheckedNormal).Width;
            textRectangleValue.Y = ClientRectangle.Y;
            textRectangleValue.Width = ClientRectangle.Width -
                RadioButtonRenderer.GetGlyphSize(g,
                RadioButtonState.UncheckedNormal).Width;
            textRectangleValue.Height = ClientRectangle.Height;
        }

        return textRectangleValue;
    }
}
' Define the text bounds so that the text rectangle 
' does not include the radio button.
Public ReadOnly Property TextRectangle() As Rectangle
    Get
        Using g As Graphics = Me.CreateGraphics()
            With textRectangleValue
                .X = Me.ClientRectangle.X + _
                    RadioButtonRenderer.GetGlyphSize(g, _
                    RadioButtonState.UncheckedNormal).Width
                .Y = Me.ClientRectangle.Y
                .Width = Me.ClientRectangle.Width - _
                    RadioButtonRenderer.GetGlyphSize(g, _
                    RadioButtonState.UncheckedNormal).Width
                .Height = Me.ClientRectangle.Height
            End With
        End Using
        Return textRectangleValue
    End Get
End Property

Comentarios

Este valor viene determinado por el estilo visual actual del sistema operativo.

Se aplica a