Share via


RadioButtonRenderer.GetGlyphSize(Graphics, RadioButtonState) Methode

Definition

Gibt die Größe des Symbols für das Optionsfeld zurück (in Pixel).

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

Parameter

g
Graphics

Die zum Zeichnen des Optionsfelds verwendete Graphics.

state
RadioButtonState

Einer der RadioButtonState-Werte, der den visuellen Zustand des Optionsfelds angibt.

Gibt zurück

Size

Eine Size, die die Größe des Symbols für das Optionsfeld darstellt (in Pixel).

Beispiele

Im folgenden Codebeispiel wird die Methode verwendet, um die GetGlyphSize Grenzen des Optionsschaltflächentexts zu bestimmen. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die RadioButtonRenderer Klasse bereitgestellt wird.

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

Hinweise

Dieser Wert wird durch den aktuellen visuellen Stil des Betriebssystems bestimmt.

Gilt für