ControlPaint.DrawButton 메서드

정의

단추 컨트롤을 그립니다.

오버로드

Name Description
DrawButton(Graphics, Rectangle, ButtonState)

지정된 상태, 지정된 그래픽 화면 및 지정된 범위 내에서 단추 컨트롤을 그립니다.

DrawButton(Graphics, Int32, Int32, Int32, Int32, ButtonState)

지정된 상태, 지정된 그래픽 화면 및 지정된 범위 내에서 단추 컨트롤을 그립니다.

DrawButton(Graphics, Rectangle, ButtonState)

Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs

지정된 상태, 지정된 그래픽 화면 및 지정된 범위 내에서 단추 컨트롤을 그립니다.

public:
 static void DrawButton(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle rectangle, System::Windows::Forms::ButtonState state);
public static void DrawButton(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, System.Windows.Forms.ButtonState state);
static member DrawButton : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.ButtonState -> unit
Public Shared Sub DrawButton (graphics As Graphics, rectangle As Rectangle, state As ButtonState)

매개 변수

graphics
Graphics

Graphics 그릴 것입니다.

rectangle
Rectangle

Rectangle 단추의 크기를 나타내는 값입니다.

state
ButtonState

단추를 그릴 상태를 지정하는 값의 ButtonState 비트 조합입니다.

추가 정보

적용 대상

DrawButton(Graphics, Int32, Int32, Int32, Int32, ButtonState)

Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs
Source:
ControlPaint.cs

지정된 상태, 지정된 그래픽 화면 및 지정된 범위 내에서 단추 컨트롤을 그립니다.

public:
 static void DrawButton(System::Drawing::Graphics ^ graphics, int x, int y, int width, int height, System::Windows::Forms::ButtonState state);
public static void DrawButton(System.Drawing.Graphics graphics, int x, int y, int width, int height, System.Windows.Forms.ButtonState state);
static member DrawButton : System.Drawing.Graphics * int * int * int * int * System.Windows.Forms.ButtonState -> unit
Public Shared Sub DrawButton (graphics As Graphics, x As Integer, y As Integer, width As Integer, height As Integer, state As ButtonState)

매개 변수

graphics
Graphics

Graphics 그릴 것입니다.

x
Int32

그리기 사각형의 왼쪽 위 모퉁이에 대한 x 좌표입니다.

y
Int32

그리기 사각형의 왼쪽 위 모퉁이에 대한 y 좌표입니다.

width
Int32

단추의 너비입니다.

height
Int32

단추의 높이입니다.

state
ButtonState

단추를 그릴 상태를 지정하는 값의 ButtonState 비트 조합입니다.

예제

#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public Form
{
private:
   Button^ button1;
   Button^ button2;

public:
   Form1()
   {
      button1 = gcnew Button;
      button2 = gcnew Button;
      this->button2->Location = Point(0,button1->Height + 10);
      this->Click += gcnew EventHandler( this, &Form1::button2_Click );
      this->Controls->Add( this->button1 );
      this->Controls->Add( this->button2 );
   }


private:

   void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      
      // Draws a flat button on button1.
      ControlPaint::DrawButton( System::Drawing::Graphics::FromHwnd( button1->Handle ), 0, 0, button1->Width, button1->Height, ButtonState::Flat );
   }

};


[STAThread]
void main()
{
   Application::Run( gcnew Form1 );
}
using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : Form
{
    private Button _button1 = new Button();
    private Button _button2 = new Button();

    [STAThread]
    static void Main()
    {
        Application.Run(new Form1());
    }

    public Form1()
    {
        _button2.Location = new Point(0, _button1.Height + 10);
        this.Click += Button2_Click;
        this.Controls.Add(_button1);
        this.Controls.Add(_button2);
    }

    private void Button2_Click(object sender, System.EventArgs e)
    {
        // Draws a flat button on button1.
        ControlPaint.DrawButton(
            System.Drawing.Graphics.FromHwnd(_button1.Handle), 0, 0,
            _button1.Width, _button1.Height,
            ButtonState.Flat);
    }

}
Imports System.Drawing
Imports System.Windows.Forms

    Public Class Form1
        Inherits System.Windows.Forms.Form

        Private button1 As System.Windows.Forms.Button = New Button
        Private button2 As System.Windows.Forms.Button = New Button

        <System.STAThreadAttribute()>  _
        Public Shared Sub Main()
            System.Windows.Forms.Application.Run(New Form1)
        End Sub

        Public Sub New()
            Me.button2.Location = New Point(0, button1.Height + 10)
            AddHandler Me.button2.Click, AddressOf Me.button2_Click
            Me.Controls.Add(Me.button1)
            Me.Controls.Add(Me.button2)
        End Sub

        Private Sub button2_Click(sender As Object, e As System.EventArgs)
            ' Draws a flat button on button1.
            ControlPaint.DrawButton(System.Drawing.Graphics.FromHwnd(button1.Handle), 0, 0, button1.Width, button1.Height, ButtonState.Flat)
        End Sub
End Class

추가 정보

적용 대상