KcHeY
Messages postés261Date d'inscriptiondimanche 23 mai 2004StatutMembreDernière intervention22 septembre 2012
-
22 déc. 2011 à 16:41
KcHeY
Messages postés261Date d'inscriptiondimanche 23 mai 2004StatutMembreDernière intervention22 septembre 2012
-
23 déc. 2011 à 17:20
Bonjour,
Je me test au déplacement d'objet, et ne comprend pas pourquoi le déplacement de gauche à droite est fluide, mais de haut en bas ou vice-versa, la picturebox clignote et avance en diagonal.
Pouvez-vous m'éclairer ?
Merci.
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Left Then
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 5, Me.PictureBox1.Location.Y)
End If
If e.KeyCode = Keys.Right Then
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 5, Me.PictureBox1.Location.Y)
End If
If e.KeyCode = Keys.Up Then
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.Y - 5, Me.PictureBox1.Location.X)
End If
If e.KeyCode = Keys.Down Then
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.Y + 5, Me.PictureBox1.Location.X)
End If
End Sub
End Class