'fabrication d'un bitmap
Public b As Bitmap = New Bitmap(930, 742)
'création de l'outil de dessin
Public g As Graphics = Graphics.FromImage(b)
Public Sub DrawPolygon(ByVal centre As Point, ByVal couleur As Color)
Dim brush = New SolidBrush(couleur)
Dim points(3) As Point
points(0) = New Point(centre.X, centre.Y - 18)
points(1) = New Point(centre.X + 32, centre.Y)
points(2) = New Point(centre.X, centre.Y + 18)
points(3) = New Point(centre.X - 32, centre.Y)
' dessiner le polygone
g.FillPolygon(brush, points)
g.DrawPolygon(Pens.White, points)
End Sub
Dim centre As New Point(x, y)
Dim couleur As Color = Color.Green
DrawPolygon(centre, couleur) 'on en dessine 1 dans le Bitmap
DrawPolygon(centre2, couleur2) 'on en dessine 2 dans le Bitmap
'mise en picturebox
PictureBox_.Image = b.Clone 'on affiche le Bitmap