RadioButtonRenderer.GetGlyphSize(Graphics, RadioButtonState) メソッド

定義

オプション ボタンのグリフのサイズをピクセル単位で返します。

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

パラメーター

g
Graphics

オプション ボタンの描画に使用する Graphics

state
RadioButtonState

オプション ボタンのビジュアル状態を指定する RadioButtonState 値の 1 つ。

戻り値

Size

オプション ボタンのグリフのサイズをピクセル単位で表す Size

次のコード例では、メソッドを GetGlyphSize 使用して、オプション ボタンテキストの境界を決定します。 このコード例は、RadioButtonRenderer クラスのために提供されている大規模な例の一部です。

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

注釈

この値は、オペレーティング システムの現在の表示スタイルによって決まります。

適用対象