Could some one please gimme the code to move picture boxes with the directional buttons?
Thank you kindly,
~W~
Printable View
Could some one please gimme the code to move picture boxes with the directional buttons?
Thank you kindly,
~W~
Try this.
It moves a form for 120 twips up/down/left/right.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
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~
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.
I give you much thanks, it works perfectly.
~W~
You're welcome...