CheckBoxRenderer.GetGlyphSize(Graphics, CheckBoxState) 메서드

정의

확인란 기호의 크기를 반환합니다.

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

매개 변수

g
Graphics

이 작업에서 사용할 Graphics입니다.

state
CheckBoxState

확인란의 표시 상태를 지정하는 CheckBoxState 값 중 하나입니다.

반환

Size

확인란 기호의 크기를 나타내는 Size입니다.

예제

다음 코드 예제에서는 GetGlyphSize 확인란 텍스트의 범위를 결정 하는 방법입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 CheckBoxRenderer 클래스입니다.

// Calculate the text bounds, exluding the check box.
Rectangle getTextRectangle()
{
    Graphics ^g = this->CreateGraphics();
    textRectangleValue.X = ClientRectangle.X +
                CheckBoxRenderer::GetGlyphSize(g,
                CheckBoxState::UncheckedNormal).Width;
    textRectangleValue.Y = ClientRectangle.Y;
    textRectangleValue.Width = ClientRectangle.Width -
                CheckBoxRenderer::GetGlyphSize(g,
                CheckBoxState::UncheckedNormal).Width;
    textRectangleValue.Height = ClientRectangle.Height;

    delete g;
    return textRectangleValue;
}
// Calculate the text bounds, exluding the check box.
public Rectangle TextRectangle
{
    get
    {
        using (Graphics g = this.CreateGraphics())
        {
            textRectangleValue.X = ClientRectangle.X +
                CheckBoxRenderer.GetGlyphSize(g,
                CheckBoxState.UncheckedNormal).Width;
            textRectangleValue.Y = ClientRectangle.Y;
            textRectangleValue.Width = ClientRectangle.Width -
                CheckBoxRenderer.GetGlyphSize(g,
                CheckBoxState.UncheckedNormal).Width;
            textRectangleValue.Height = ClientRectangle.Height;
        }

        return textRectangleValue;
    }
}
' Calculate the text bounds, exluding the check box.
Public ReadOnly Property TextRectangle() As Rectangle
    Get
        Using g As Graphics = Me.CreateGraphics()
            With textRectangleValue
                .X = Me.ClientRectangle.X + _
                    CheckBoxRenderer.GetGlyphSize(g, _
                    CheckBoxState.UncheckedNormal).Width
                .Y = Me.ClientRectangle.Y
                .Width = Me.ClientRectangle.Width - _
                    CheckBoxRenderer.GetGlyphSize(g, _
                    CheckBoxState.UncheckedNormal).Width
                .Height = Me.ClientRectangle.Height
            End With
        End Using
        Return textRectangleValue
    End Get
End Property

설명

확인란 기호의 크기는 운영 체제의 현재 비주얼 스타일에 의해 결정 됩니다.

적용 대상