Share via


方法 : ソリッド ブラシを作成する

更新 : 2007 年 11 月

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 を呼び出す必要があります。

参照

概念

GDI+ でのブラシと塗りつぶされた図形

参照

SolidBrush

Brush

その他の技術情報

グラフィックス プログラミングについて

ブラシを使用した図形の塗りつぶし