RadioButtonRenderer.GetGlyphSize(Graphics, RadioButtonState) Méthode

Définition

Retourne la taille, en pixels, du glyphe de la case d'option.

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

Paramètres

g
Graphics

Graphics utilisé pour dessiner la case d'option.

state
RadioButtonState

Une des valeurs RadioButtonState qui spécifie l'état visuel de la case d'option.

Retours

Size

Size qui représente la taille, en pixels, du glyphe de la case d'option.

Exemples

L’exemple de code suivant utilise la GetGlyphSize méthode pour déterminer les limites du texte du bouton d’option. Cet exemple de code fait partie d’un exemple plus grand fourni pour la RadioButtonRenderer classe.

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

Remarques

Cette valeur est déterminée par le style visuel actuel du système d’exploitation.

S’applique à