How to: Create a Solid Brush
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;
After you have finished using them, you should call Dispose on objects that consume system resources, such as brush objects.