|
-
Apr 22nd, 2002, 08:21 PM
#1
NEVER MIND FOUND OUT
okay as you people might know in order to move a image box left you minus 100 of the left well how come this doesn't work?
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 52 And step = 1 And thrand.Left < Image1.Left And thrand.Left + thrand.Width < osweet.Left Then
thrand.Left = Val(thrand.Left) - Val(a)
thrand.Picture = Form3.lefta.Picture
End If
If KeyAscii = 54 And step = 1 And thrand.Left + thrand.Width < osweet.Left Then
thrand.Left = Val(thrand.Left) + Val(a)
thrand.Picture = Form3.right.Picture
End If
If step = 1 And KeyAscii = 56 And thrand.Top <= Image1.Top Then
thrand.Move thrand.Top + 100
thrand.Picture = Form3.up.Picture
End If
End Sub
moving right works though
-
Apr 22nd, 2002, 08:32 PM
#2
Hyperactive Member
What R U Trying To Do? Get A Image To Move Around?
What Is Thrand?
What Is osweet?
-
Apr 22nd, 2002, 08:33 PM
#3
read the book called dream carvers by joan clark
-
Apr 22nd, 2002, 08:52 PM
#4
Hyperactive Member
Try This:
VB Code:
Private Sub Form_KeyDown(Keycode As Integer, Shift As Integer)
Call MoveObject(Image1, Keycode)
End Sub
Private Function MoveObject(Object As Object, Keycode As Integer)
Select Case Keycode
Case vbKeyUp
If Object.Top < 0 Then: Object.Top = Me.Height
Object.Top = Object.Top - 100
Exit Function
Case vbKeyDown
If Object.Top > Me.Height Then: Object.Top = 0
Object.Top = Object.Top + 100
Exit Function
Case vbKeyRight
If Object.Left > Me.Width Then: Object.Left = 0
Object.Left = Object.Left + 100
Exit Function
Case vbKeyLeft
If Object.Left < 0 Then: Object.Left = Me.Width
Object.Left = Object.Left - 100
Exit Function
End Select
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|