Comment : créer un pinceau plein, ou SolidBrush

Cet exemple crée un objet SolidBrush qui peut être utilisé par un objet Graphics pour remplir des formes.

Exemple

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;

Programmation fiable

Lorsque vous avez fini de les utiliser, appelez Dispose sur les objets qui utilisent des ressources système, tels que les objets Brush.

Voir aussi

Référence

SolidBrush

Brush

Concepts

Pinceaux et remplissage de formes dans GDI+

Autres ressources

Mise en route de la programmation graphique

Utilisation d'un pinceau pour remplir des formes