|
-
Feb 22nd, 2001, 05:38 PM
#1
Thread Starter
New Member
Could some one please gimme the code to move picture boxes with the directional buttons?
Thank you kindly,
~W~
-
Feb 22nd, 2001, 05:42 PM
#2
Addicted Member
Try this.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp
Me.Top = Me.Top - 120
Case vbKeyDown
Me.Top = Me.Top + 120
Case vbKeyLeft
Me.Left = Me.Left - 120
Case vbKeyRight
Me.Left = Me.Left + 120
End Select
End Sub
It moves a form for 120 twips up/down/left/right.
-
Feb 22nd, 2001, 06:09 PM
#3
Thread Starter
New Member
Humm...
Thanks for your reply, but I’m not really looking to move the whole form. I'm trying to move just a picture box on the form.
Again thank you for your reply and any further code would be greatly appreciated.
~W~
-
Feb 22nd, 2001, 06:19 PM
#4
Addicted Member
Yes I know.
I just gave you a general example. To move a PictureBox, simply replace the ME keyword with the name of a PictureBox and set the KeyPreview propery of a form to TRUE, or place the code in PictureBox's KeyDown event.
-
Feb 22nd, 2001, 06:47 PM
#5
Thread Starter
New Member
Thank you
I give you much thanks, it works perfectly.
~W~
-
Feb 22nd, 2001, 06:52 PM
#6
Addicted Member
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
|