방법: 단색 브러시 만들기

이 예제에서는 도형을 채우기 위해 Graphics 개체에서 사용할 수 있는 SolidBrush 개체를 만듭니다.

예제

Dim myBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
Dim formGraphics As System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.FillEllipse(myBrush, New Rectangle(0, 0, 200, 300))
myBrush.Dispose()
formGraphics.Dispose()
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics;
formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0, 0, 200, 300));
myBrush.Dispose();
formGraphics.Dispose();
System::Drawing::SolidBrush^ myBrush =
    gcnew System::Drawing::SolidBrush(System::Drawing::Color::Red);
System::Drawing::Graphics^ formGraphics;
formGraphics = this->CreateGraphics();
formGraphics->FillEllipse(myBrush, Rectangle(0, 0, 200, 300));
delete myBrush;
delete formGraphics;

강력한 프로그래밍

브러시 개체와 같이 시스템 리소스를 사용하는 개체에 대해서는 사용 후 항상 Dispose를 호출해야 합니다.

참고 항목

참조

SolidBrush

Brush

개념

GDI+의 브러시 및 채워진 도형

기타 리소스

그래픽 프로그래밍 시작

브러시를 사용하여 도형 채우기