导航

常用快捷键

Posted on 2017-11-13 00:07  清浅ヾ  阅读(126)  评论(0编辑  收藏  举报
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.KeyPreview = true;
            this.KeyDown += new KeyEventHandler(form1_KeyDown);
        }
        private void form1_KeyDown(object sender,KeyEventArgs e)
        {
            if (e.Modifiers==(Keys.Control|Keys.Alt)&&e.KeyCode==Keys.Q)
            {
                new Form2().ShowDialog();
            }
            if (e.KeyCode==Keys.Enter)
            {
                button1_Click(null,null);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            new Form3().ShowDialog();  
        } 
    }
}