CheckBoxRenderer.DrawCheckBox 메서드

정의

CheckBox 컨트롤을 그립니다.

오버로드

DrawCheckBox(Graphics, Point, CheckBoxState)

지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Boolean, CheckBoxState)

지정된 텍스트와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState)

지정된 텍스트 및 텍스트 형식과 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, CheckBoxState)

지정된 텍스트 및 이미지와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, CheckBoxState)

지정된 텍스트, 텍스트 형식 및 이미지와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

DrawCheckBox(Graphics, Point, CheckBoxState)

지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, state As CheckBoxState)

매개 변수

g
Graphics

확인란을 그릴 때 사용되는 Graphics입니다.

glyphLocation
Point

확인란 기호를 그릴 Point입니다.

state
CheckBoxState

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

설명

운영 체제에서 비주얼 스타일을 사용 하 고 현재 애플리케이션에 비주얼 스타일을 적용 하는 경우이 메서드는 현재 비주얼 스타일을 사용 하 여 확인란을 그립니다. 그렇지 않으면 확인란 Windows 클래식 스타일으로 그려집니다.

적용 대상

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Boolean, CheckBoxState)

지정된 텍스트와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, focused As Boolean, state As CheckBoxState)

매개 변수

g
Graphics

확인란을 그릴 때 사용되는 Graphics입니다.

glyphLocation
Point

확인란 기호를 그릴 Point입니다.

textBounds
Rectangle

checkBoxText를 그릴 Rectangle입니다.

checkBoxText
String

확인란을 사용해 그릴 String입니다.

font
Font

checkBoxText에 적용할 Font입니다.

focused
Boolean

포커스 영역을 그리려면 true로 설정하고, 그렇지 않으면 false로 설정합니다.

state
CheckBoxState

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

설명

운영 체제에서 비주얼 스타일을 사용 하 고 현재 애플리케이션에 비주얼 스타일을 적용 하는 경우이 메서드는 현재 비주얼 스타일을 사용 하 여 확인란을 그립니다. 그렇지 않으면 확인란 Windows 클래식 스타일으로 그려집니다.

적용 대상

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState)

지정된 텍스트 및 텍스트 형식과 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As CheckBoxState)

매개 변수

g
Graphics

확인란을 그릴 때 사용되는 Graphics입니다.

glyphLocation
Point

확인란 기호를 그릴 Point입니다.

textBounds
Rectangle

checkBoxText를 그릴 Rectangle입니다.

checkBoxText
String

확인란을 사용해 그릴 String입니다.

font
Font

checkBoxText에 적용할 Font입니다.

flags
TextFormatFlags

TextFormatFlags 값의 비트 조합입니다.

focused
Boolean

포커스 영역을 그리려면 true로 설정하고, 그렇지 않으면 false로 설정합니다.

state
CheckBoxState

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

예제

다음 코드 예제에서는 합니다 DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, CheckBoxState) 메서드는 사용자 지정 컨트롤의 OnPaint 메서드를 마우스 포인터의 위치에 따라 결정 되는 상태의 확인란을 그립니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 CheckBoxRenderer 클래스입니다.

// Draw the check box in the current state.
virtual void OnPaint(PaintEventArgs ^e) override
{
    Control::OnPaint(e);

    CheckBoxRenderer::DrawCheckBox(e->Graphics,
        ClientRectangle.Location, this->getTextRectangle(), this->Text,
        this->Font, TextFormatFlags::HorizontalCenter,
        clicked, state);
}


// Draw the check box in the checked or unchecked state, alternately.
virtual void OnMouseDown(MouseEventArgs ^e) override
{
    Control::OnMouseDown(e);

    if (!clicked)
    {
        clicked = true;
        this->Text = "Clicked!";
        state = CheckBoxState::CheckedPressed;
        Invalidate();
    }
    else
    {
        clicked = false;
        this->Text = "Click here";
        state = CheckBoxState::UncheckedNormal;
        Invalidate();
    }
}
// Draw the check box in the current state.
protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    CheckBoxRenderer.DrawCheckBox(e.Graphics,
        ClientRectangle.Location, TextRectangle, this.Text,
        this.Font, TextFormatFlags.HorizontalCenter,
        clicked, state);
}

// Draw the check box in the checked or unchecked state, alternately.
protected override void OnMouseDown(MouseEventArgs e)
{
    base.OnMouseDown(e);

    if (!clicked)
    {
        clicked = true;
        this.Text = "Clicked!";
        state = CheckBoxState.CheckedPressed;
        Invalidate();
    }
    else
    {
        clicked = false;
        this.Text = "Click here";
        state = CheckBoxState.UncheckedNormal;
        Invalidate();
    }
}
' Draw the check box in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    MyBase.OnPaint(e)
    CheckBoxRenderer.DrawCheckBox(e.Graphics, _
        Me.ClientRectangle.Location, TextRectangle, Me.Text, _
        Me.Font, TextFormatFlags.HorizontalCenter, _
        clicked, state)
End Sub

' Draw the check box in the checked or unchecked state, alternately.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
    MyBase.OnMouseDown(e)
    If Not clicked Then
        With Me
            .clicked = True
            .Text = "Clicked!"
            .state = CheckBoxState.CheckedPressed
        End With
        Invalidate()
    Else
        With Me
            .clicked = False
            .Text = "Click here"
            .state = CheckBoxState.UncheckedNormal
        End With
        Invalidate()
    End If
End Sub

설명

운영 체제에서 비주얼 스타일을 사용 하 고 현재 애플리케이션에 비주얼 스타일을 적용 하는 경우이 메서드는 현재 비주얼 스타일을 사용 하 여 확인란을 그립니다. 그렇지 않으면 확인란 Windows 클래식 스타일으로 그려집니다.

적용 대상

DrawCheckBox(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, CheckBoxState)

지정된 텍스트 및 이미지와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, image As Image, imageBounds As Rectangle, focused As Boolean, state As CheckBoxState)

매개 변수

g
Graphics

확인란을 그릴 때 사용되는 Graphics입니다.

glyphLocation
Point

확인란 기호를 그릴 Point입니다.

textBounds
Rectangle

checkBoxText를 그릴 Rectangle입니다.

checkBoxText
String

확인란을 사용해 그릴 String입니다.

font
Font

checkBoxText에 적용할 Font입니다.

image
Image

확인란을 사용해 그릴 Image입니다.

imageBounds
Rectangle

image의 크기를 나타내는 Rectangle입니다.

focused
Boolean

포커스 영역을 그리려면 true로 설정하고, 그렇지 않으면 false로 설정합니다.

state
CheckBoxState

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

설명

운영 체제에서 비주얼 스타일을 사용 하 고 현재 애플리케이션에 비주얼 스타일을 적용 하는 경우이 메서드는 현재 비주얼 스타일을 사용 하 여 확인란을 그립니다. 그렇지 않으면 확인란 Windows 클래식 스타일으로 그려집니다.

적용 대상

DrawCheckBox(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, CheckBoxState)

지정된 텍스트, 텍스트 형식 및 이미지와 선택적 포커스 영역을 사용하여 지정된 위치에 지정된 상태의 CheckBox 컨트롤을 그립니다.

public:
 static void DrawCheckBox(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ checkBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string checkBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
public static void DrawCheckBox (System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? checkBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member DrawCheckBox : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.CheckBoxState -> unit
Public Shared Sub DrawCheckBox (g As Graphics, glyphLocation As Point, textBounds As Rectangle, checkBoxText As String, font As Font, flags As TextFormatFlags, image As Image, imageBounds As Rectangle, focused As Boolean, state As CheckBoxState)

매개 변수

g
Graphics

확인란을 그릴 때 사용되는 Graphics입니다.

glyphLocation
Point

확인란 기호를 그릴 Point입니다.

textBounds
Rectangle

checkBoxText를 그릴 Rectangle입니다.

checkBoxText
String

확인란을 사용해 그릴 String입니다.

font
Font

checkBoxText에 적용할 Font입니다.

flags
TextFormatFlags

TextFormatFlags 값의 비트 조합입니다.

image
Image

확인란을 사용해 그릴 Image입니다.

imageBounds
Rectangle

image의 크기를 나타내는 Rectangle입니다.

focused
Boolean

포커스 영역을 그리려면 true로 설정하고, 그렇지 않으면 false로 설정합니다.

state
CheckBoxState

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

설명

운영 체제에서 비주얼 스타일을 사용 하 고 현재 애플리케이션에 비주얼 스타일을 적용 하는 경우이 메서드는 현재 비주얼 스타일을 사용 하 여 확인란을 그립니다. 그렇지 않으면 확인란 Windows 클래식 스타일으로 그려집니다.

적용 대상