VB.Net PictureBox

Résolu
cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 6 sept. 2007 à 18:41
cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 6 sept. 2007 à 21:45
Salut...

Je veux faire apparaittre plusieurs cercle (à partir d'un Tableau) dans un PictureBox.
Le code ci-dessous affiche qu'un seul cercle.
Comment est-il possible de coder afin de ne pas effacer le cercle et d'en mettre un nouveau...

J'ai fais plein de test mais je n'y arrive pas...
Meri d'avance

P.S. je suis en compact framwork mais j'ai besoin de vos idées...

Private



Sub
BtnCercle_Click(

ByVal
sender

As
System.Object,

ByVal
e

As
System.EventArgs)

Handles
cmdDessin.Click


Dim
objBitMap

As



New
Bitmap(PictureBox1.Width, PictureBox1.Height)


Dim
objGraphics

As
Graphics


Dim
MonRectable

As
Rectangle


Dim
MaBrush

As
Brush


Dim
i

As



Integer

Dim
CoordX

As



Double
, CoordY

As



Double






For
i = 0

To
UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
CoordX = ((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000)
CoordY = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000)
objGraphics = Graphics.FromImage(objBitMap)
MonRectable =

New
Rectangle(CoordX, CoordY, 5, 5)
MaBrush =

New
SolidBrush(Color.Blue)
objGraphics.Clear(Color.White)
objGraphics.FillEllipse(MaBrush, MonRectable)


Me
.PictureBox1.Image = objBitMap
objGraphics.Dispose()
objGraphics =

Nothing

Next
i


End



Sub

1 réponse

cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 4
6 sept. 2007 à 21:45
J'ai trouvé..

Private
Sub BtnCercle_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles cmdDessin.Click

Dim objBitMap
As
New Bitmap(PictureBox1.Width, PictureBox1.Height)

Dim objGraphics
As Graphics

Dim MonRectable
As Rectangle

Dim MaBrush
As Brush

Dim i
As
Integer

Dim CoordX
As
Double, CoordY
As
Double

For i = 0
To UBound(Tableau)LigneSplit = Tableau(i).Split(Separateur)

CoordX = ((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000)

CoordY = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000)

objGraphics = Graphics.FromImage(objBitMap)
MonRectable New Rectangle(CoordX, CoordY.ToString, 1, 1)MaBrush

New SolidBrush(Color.Blue)

If i = 0
Then objGraphics.Clear(Color.White)objGraphics.FillEllipse(MaBrush, MonRectable)

Me.PictureBox1.Image = objBitMapobjGraphics.Dispose()

objGraphics =

Nothing

Next i

End
Sub
3
Rejoignez-nous