jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 16 juil. 2007 à 16:23
Re,
Regarde si ceci te convient.
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Dim top As Integer = PictureBox1.Top
Dim left As Integer = PictureBox1.Left
If e.KeyCode = Keys.Down Then top += 20
If e.KeyCode = Keys.Up Then top -= 20
If e.KeyCode = Keys.Right Then left += 20
If e.KeyCode = Keys.Left Then left -= 20
PictureBox1.Location = New System.Drawing.Point(left, top)
jmfmarques
Messages postés7666Date d'inscriptionsamedi 5 novembre 2005StatutMembreDernière intervention22 août 201427 16 juil. 2007 à 15:46
1) tu ne développes apparemment pas en vb.Net mais en VB6
"Poste" donc là où il convient la prochaine fois s'il te plait
2) la flêche haute a(valeur Keycode 3_) n'est pas reconnue au Kreypress mais au KeyDown
3) la propriété Keypreview de ta Form doit être placée à True
4) ne peut fonctionner si un bouton de commande a le focus
5) on ne dit pas Form1_... mais Form_...
6) code :
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then .....
End Sub