Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
- private int GetIndex(Keys key)
- {
- switch (key)
- {
- case Keys.D1:
- return 0;
- case Keys.D2:
- return 1;
- case Keys.D3:
- return 2;
- case Keys.D4:
- return 3;
- case Keys.D5:
- return 4;
- case Keys.D6:
- return 5;
- case Keys.D7:
- return 6;
- case Keys.D8:
- return 7;
- default:
- return -1;
- }
- }
- private void Form1_KeyDown(object sender, KeyEventArgs e)
- {
- Keys key = e.KeyCode;
- Console.WriteLine(key + "");
- if (e.Alt)
- {
- int row = GetIndex(key);
- if (row != -1)
- {
- RevertRow(row);
- Invalidate();
- }
- }
- e.Handled = true;
- }
Add Comment
Please, Sign In to add comment