allora alla fin fine il tuo problema è spostare una image dal punto A a B.
per spostare l'image nella programmazione si modifica il valore della proprietà left dell'oggetto da spostare.
se lo spostamento è da sinistra a destra la incrementerai
se lo spostamento è da destra a sinistra decrementerai il valore.
nel tuo caso
metti questo codice nel form che ha 4 bottoni, 2 timer e 2 image (chiamate img1 e img2)
Option Explicit
Private Sub Command1_Click()
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
If img2.Left + img2.Width > img1.Left Then
Timer1.Enabled = False
Else
img2.Left = img2.Left + 100
End If
End Sub
Private Sub Command3_Click()
Timer2.Interval = 1000
Timer2.Enabled = True
End Sub
Private Sub Command4_Click()
Timer2.Enabled = False
End Sub
Private Sub Timer2_Timer()
If img2.Left + img2.Width > img1.Left Then
Timer2.Enabled = False
Else
img2.Left = img2.Left - 100
End If
End Sub
è quello che volevi?
chiedi ciò che non è chiaro....
Ultima modifica effettuata da poeo85 il 25/01/2011 alle 14:23 |