Bonjour,

Je souhaiterais attribuer les touches du pavé numérique aux boutons de mon formulaire.

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace WindowsFormsApplication1
{
    public partial class Menu : Form
    {
        public Menu()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            Conditionnement video = new Conditionnement();
            video.ShowDialog();
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            Reception video = new Reception();
            video.ShowDialog();
        }
 
        private void button6_Click(object sender, EventArgs e)
        {
            Decoupe video = new Decoupe();
            video.ShowDialog();
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
            Pesee video = new Pesee();
            video.ShowDialog();
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            Precuisson video = new Precuisson();
            video.ShowDialog();
        }
 
        private void button5_Click(object sender, EventArgs e)
        {
            Deconditionnement video = new Deconditionnement();
            video.ShowDialog();
        }
 
        private void Menu_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.NumPad1)
            {
                button1_Click(sender, e);
            }
 
            if (e.KeyCode == Keys.NumPad2)
            {
                button2_Click(sender, e);
            }
        }   
    }
}
Je n'ai aucune erreur, cependant rien ne se passe quand j'appuie sur les touches 1 et 2...

Merci d'avance !