Tableau d'images

schub1015 Messages postés 32 Date d'inscription mardi 4 février 2003 Statut Membre Dernière intervention 10 juillet 2007 - 4 mai 2004 à 15:04
schub1015 Messages postés 32 Date d'inscription mardi 4 février 2003 Statut Membre Dernière intervention 10 juillet 2007 - 5 mai 2004 à 17:09
Bonjour,

j'ai un pb avec un tableau d'images. En effet, je voudrais créer une sorte d'undo sur mon objet PictureBox.

Pour avoir une solution simple, j'ai décidé de créer un tableau de picturebox et de lui appliquer l'image du controle.

Lors de l'éxécution, il me dit "Variable Objet ou variable bloc with non défini ".

Voici mon code :

'déclaration en global

Private tab_im(5) As picturebox

'lors de l'appui sur le bouton Undo

Picture1.Picture = Picture1.image
For i = 0 To 5
If i = 0 Then
tab_im.Picture = Picture1.Picture
Else
tab_im(i).Picture = tab_im(i - 1).Picture
End If
Next i

2 réponses

cs_labout Messages postés 1356 Date d'inscription samedi 8 décembre 2001 Statut Membre Dernière intervention 23 octobre 2006 8
4 mai 2004 à 15:30
labout

Voila comment faire
Ici j'ai mis un bouton et 2 pictureBox

Private Sub Command1_Click()

Dim tab_im As New Collection
'lors de l'appui sur le bouton Undo

Dim i As Integer
For i = 1 To 5
If i = 1 Then
tab_im.Add Picture1.Image
Else
tab_im.Add tab_im(i - 1)
End If
Next i
Picture2.Picture = tab_im(2)
End Sub
@+
0
schub1015 Messages postés 32 Date d'inscription mardi 4 février 2003 Statut Membre Dernière intervention 10 juillet 2007
5 mai 2004 à 17:09
J'ai différents pb avec la sauvegardes de mes images. Il y a un pb lors de l'effacement de toutes les images et si on retrace des lignes, le truc part en vrille

Merci pour votre aide.

voici mon code :

' lors d'un clic souris sur le picture box

Static clic As Integer
Static toto As Integer
image1.DrawWidth = 3
If clic = 0 Then


ReDim Preserve tabcoord(indice + 1)
tabcoord(indice).x = x
tabcoord(indice).y = y
indice = indice + 1
clic = 1
Else

ReDim Preserve tabcoord(indice + 1)
tabcoord(indice).x = x
tabcoord(indice).y = y
indice = indice + 1

image1.Line (tabcoord(indice - 2).x, tabcoord(indice - 2).y)-(x, y)
clic = 1

image1.Picture = image1.Image
tab_im.Add image1.Image
toto = tab_im.Count

Dim i As Integer
i = 0
End If

'lors d'un clic sur le bouton undo

Dim i As Integer

If (tab_im.Count > 2) Then
image1.Picture = tab_im.Item(tab_im.Count - 2)

tab_im.Remove (tab_im.Count - 1)
indice = indice - 1 If ((tab_im.Count 2) And (titi False)) Then
tab_im.Remove (2)
titi = True
End If
Else

'image1.Picture = il faut remettre la première image
End If
0
Rejoignez-nous