Déplacement de picturebox

Résolu
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012 - 22 déc. 2011 à 16:41
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 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

21 réponses

Utilisateur anonyme
22 déc. 2011 à 18:52
Bonsoir,

Un point s'écrit en coordonnées x,y.
Dans ton code, ton point est de la forme y,x.
Inverse les et tout rentrera dans l'ordre.
3
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
22 déc. 2011 à 18:56
Bonjour,

Tu es sûr que X et Y sont dans le bon ordre ?
New System.Drawing.Point(Me.PictureBox1.Location.Y - 5, Me.PictureBox1.Location.X)

Pour le clignotement, intéresses-toi au double buffering.

---------------------------------------------------------------------
[list=ordered][*]Pour poser correctement une question et optimiser vos chances d'obtenir des réponses, pensez à lire le règlement CS, ce lien ou encore celui-ci[*]Quand vous postez un code, merci d'utiliser la coloration syntaxique (3ième icône en partant de la droite : )
[*]Si votre problème est résolu (et uniquement si c'est le cas), pensez à mettre "Réponse acceptée" sur le ou les messages qui vous ont aidés./list
---
3
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
22 déc. 2011 à 20:08
Bonjour,

Il faut que tu contrôle la position X et Y (et éventuellement la taille de la PictureBox).

---------------------------------------------------------------------
[list=ordered][*]Pour poser correctement une question et optimiser vos chances d'obtenir des réponses, pensez à lire le règlement CS, ce lien ou encore celui-ci[*]Quand vous postez un code, merci d'utiliser la coloration syntaxique (3ième icône en partant de la droite : )
[*]Si votre problème est résolu (et uniquement si c'est le cas), pensez à mettre "Réponse acceptée" sur le ou les messages qui vous ont aidés./list
---
3
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
22 déc. 2011 à 19:58
Bonsoir,

Merci bien, effectivement j'avais pas inversé comme il fallais héhé.

Résolu merci à vous.

Public Class Form1

  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.X, Me.PictureBox1.Location.Y - 5)
        End If
        If e.KeyCode = Keys.Down Then
            Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 5)
        End If
    End Sub

End Class
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
22 déc. 2011 à 20:02
Est-il possible de mettre des limites (barrières) à la picture box ?
Pour fabriquer un labyrinthe par exemple.
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
22 déc. 2011 à 20:10
Ok merci je pensais bien que ce ne serai pas tâches facile.
En + la position pourrai changer si la fenêtre est redimensionné.
Merci pour cet éclaircissement.
0
Utilisateur anonyme
22 déc. 2011 à 20:17
Interesse toi aussi à la classe Rectangle qui te permet facilement de tester si un objet rectangulaire recoupe un autre objet rectangulaire :
If Rectangle.Intersect(picturebox1.bounds, picturebox2.bounds) <> Rectangle.Empty Then ...
0
Utilisateur anonyme
22 déc. 2011 à 20:30
Exemple (à rajouter à ton code plus haut) :
If Rectangle.Intersect(PictureBox1.Bounds, Me.ClientRectangle) <> PictureBox1.Bounds Then
  MessageBox.Show("picturebox1 est sorti du formulaire")
End If
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
22 déc. 2011 à 20:35
Bonsoir,

Merci pour cette info très utile.
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 12:58
Le format image .PNG est-il pris en compte pour une picturebox ?
Je ne parviens pas à afficher mon image.
Je souhaiterai animer une araignée.
J'ai créé 12 images.
4 images 1 déplacement.
je souhaiterai qu'au moment ou je déplace mon araignée, 4 images s'enchaine comme un gif.
Donc j'imagine que sa pourrai donner ça :

 
If e.KeyCode = Keys.Up Then
            Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
PictureBox1.image = my.resources.a1
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
PictureBox1.image = my.resources.a2
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
PictureBox1.image = my.resources.a3
Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
PictureBox1.image = my.resources.a4
        End If


Le soucis c'est que mon image ne s'affiche pas dans la picturebox.
Le format PNG et la transparence des images ne sont-elles pas pris en compte?
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 12:59
Oh tellement la tête dans l'araignée que je n'ai pas dis bonjour ^^

Bonjour !
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 13:03
Apparement non car mêmeavec un jpg mon image ne s'affiche pas.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.Image = My.Resources.aa1
    End Sub
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 13:13
Je précise que même si j'essai d'ajouter manuellement l'image ou le backroundimage depuis l'interface de propriété, cela ne fonctionne pas..
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 13:17
Désolé je fais que d'éditer mais je viens de me rendre compte que je ne peux même plus mettre d'image sur un bouton...
Vous avez une idée d'où viens ce soucis ?
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 13:34
Roooh il fallais que je mette la proriété de l'image à stretch. :p
@ bientôt.
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 14:05
Re,

Voici mon idée (qui ne fonctionne pas).
J'ai aussi essayer en faisant une suite de IF, de ELSEIF.. mais rien a faire.

        If e.KeyCode = Keys.NumPad8 Then   'haut
            Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 5)
            If PictureBox1.BackgroundImage Is My.Resources.a1 Then
                PictureBox1.BackgroundImage = My.Resources.a2
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a2 Then
                PictureBox1.BackgroundImage = My.Resources.a3
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a3 Then
                PictureBox1.BackgroundImage = My.Resources.a4
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a4 Then
                PictureBox1.BackgroundImage = My.Resources.a5
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a5 Then
                PictureBox1.BackgroundImage = My.Resources.a6
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a6 Then
                PictureBox1.BackgroundImage = My.Resources.a7
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a7 Then
                PictureBox1.BackgroundImage = My.Resources.a8
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a8 Then
                PictureBox1.BackgroundImage = My.Resources.a9
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a9 Then
                PictureBox1.BackgroundImage = My.Resources.a10
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a10 Then
                PictureBox1.BackgroundImage = My.Resources.a11
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a11 Then
                PictureBox1.BackgroundImage = My.Resources.a12
            ElseIf PictureBox1.BackgroundImage Is My.Resources.a12 Then
                PictureBox1.BackgroundImage = My.Resources.a1
            End If
            End If
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 14:38
Comme ceci non plus :

If e.KeyCode = Keys.NumPad8 Then   'haut
            If PictureBox1.BackgroundImage.Equals(My.Resources.a1) Then
                PictureBox1.BackgroundImage = My.Resources.a2
                PictureBox1.BackgroundImage = My.Resources.a2
                PictureBox1.BackgroundImage = My.Resources.a3
                PictureBox1.BackgroundImage = My.Resources.a4
                PictureBox1.BackgroundImage = My.Resources.a5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 5)

                If PictureBox1.BackgroundImage.Equals(My.Resources.a5) Then
                    PictureBox1.BackgroundImage = My.Resources.a6
                    PictureBox1.BackgroundImage = My.Resources.a7
                    PictureBox1.BackgroundImage = My.Resources.a8
                    PictureBox1.BackgroundImage = My.Resources.a9
                    Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 5)

                    If PictureBox1.BackgroundImage.Equals(My.Resources.a9) Then
                        PictureBox1.BackgroundImage = My.Resources.a10
                        PictureBox1.BackgroundImage = My.Resources.a11
                        PictureBox1.BackgroundImage = My.Resources.a12
                        PictureBox1.BackgroundImage = My.Resources.a1
                    End If
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 14:56
Yes j'ai reussi !
Il fallais déclarer toute mes ressources en haut de page ^^
Merci !!!!!!!!
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 16:17
Bonsoir !
Voici mon code final qui controle l'araigné avec les touches du pavé numérique.
Une chose me dérange dans tout ça, c'est que quand je reste appuyé, l'araigné va trop vite, pouvons nous régler les images par secondes ?
Cordialement.
0
KcHeY Messages postés 261 Date d'inscription dimanche 23 mai 2004 Statut Membre Dernière intervention 22 septembre 2012
23 déc. 2011 à 16:21
Oups le voici.

Public Class Form1
    Dim pas1 As Image = My.Resources.a1
    Dim pas2 As Image = My.Resources.a2
    Dim pas3 As Image = My.Resources.a3
    Dim pas4 As Image = My.Resources.a4
    Dim pas5 As Image = My.Resources.a5
    Dim pas6 As Image = My.Resources.a6
    Dim pas7 As Image = My.Resources.a7
    Dim pas8 As Image = My.Resources.a8
    Dim pas9 As Image = My.Resources.a9
    Dim pas10 As Image = My.Resources.a10
    Dim pas11 As Image = My.Resources.a11
    Dim pas12 As Image = My.Resources.a12
    Dim pas13 As Image = My.Resources.a13
    Dim pas14 As Image = My.Resources.a14
    Dim pas15 As Image = My.Resources.a15
    Dim pas16 As Image = My.Resources.a16

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.BackgroundImage = pas1
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

        If Rectangle.Intersect(PictureBox1.Bounds, Me.ClientRectangle) <> PictureBox1.Bounds Then
            MessageBox.Show("picturebox1 est sorti du formulaire")
        End If

        If e.KeyCode = Keys.NumPad8 Then   'haut
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y - 1)
            End If
         End If

        If e.KeyCode = Keys.NumPad2 Then  'bas
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X, Me.PictureBox1.Location.Y + 1)
            End If
        End If

        If e.KeyCode = Keys.NumPad4 Then 'left
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y)
            End If
        End If




        If e.KeyCode = Keys.NumPad6 Then 'right
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y)
            End If
        End If





        If e.KeyCode = Keys.NumPad9 Then  'haut droit
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y - 1)
            End If
        End If




        If e.KeyCode = Keys.NumPad7 Then  'haut gauche
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y - 1)
            End If
        End If



        If e.KeyCode = Keys.NumPad3 Then  'bas droit
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X + 1, Me.PictureBox1.Location.Y + 1)
            End If
        End If



        If e.KeyCode = Keys.NumPad1 Then  'bas gauche
            If PictureBox1.BackgroundImage Is Me.pas1 Then
                PictureBox1.BackgroundImage = pas2
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas3
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas4
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas5
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas5 Then
                PictureBox1.BackgroundImage = pas6
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas7
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas8
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas9
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas9 Then
                PictureBox1.BackgroundImage = pas10
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas11
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas12
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas13
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)

            ElseIf PictureBox1.BackgroundImage Is Me.pas13 Then
                PictureBox1.BackgroundImage = pas14
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas15
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas16
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
                PictureBox1.BackgroundImage = pas1
                Me.PictureBox1.Location = New System.Drawing.Point(Me.PictureBox1.Location.X - 1, Me.PictureBox1.Location.Y + 1)
            End If
        End If
    End Sub



End Class
0
Rejoignez-nous