Dim fx As Boolean Dim su As IntegerPrivate Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = Asc("p") Then Timer1.Enabled = False If KeyAscii = Asc("g") Then Timer1.Enabled = True End SubPrivate Sub Form_Load() fx = False su = 1 End SubPrivate Sub Timer1_Timer() If fx = False Then Shape1.Top = Shape1.Top + su * 100 If Shape1.Top > Form1.Height - Shape1.Height Then fx = True Else Shape1.Top = Shape1.Top - su * 100 If Shape1.Top < 0 Then fx = False End If End Sub
Dim su As IntegerPrivate Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("p") Then Timer1.Enabled = False
If KeyAscii = Asc("g") Then Timer1.Enabled = True
End SubPrivate Sub Form_Load()
fx = False
su = 1
End SubPrivate Sub Timer1_Timer()
If fx = False Then
Shape1.Top = Shape1.Top + su * 100
If Shape1.Top > Form1.Height - Shape1.Height Then fx = True
Else
Shape1.Top = Shape1.Top - su * 100
If Shape1.Top < 0 Then fx = False
End If
End Sub