if (e.Control&&e.Shift && (e.KeyCode == Keys.V)) { MessageBox.Show("Ctrl+Shift+V"); }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace WindowsApplication5 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control) { Form2 fr = new Form2(); fr.Show(); } } } }按住Ctrl +A弹出Form2窗体
private void Form1_KeyDown(object sender, KeyEventArgs e)
{ if (e.Control&&e.Shift && (e.KeyCode == Keys.V))
{
MessageBox.Show("Ctrl+Shift+V");
} }
要设置Form的KeyPreview=true
嗯,就是那个意思,就是在一个首先运行程序出现 一个界面,然后焦点在那个界面上面,然后再按Ctrl+A就再弹出一个对话框就行了,这个该如何实现呢?
{
if (e.KeyCode == Keys.A && e.Modifiers = Keys.Control)
{
Form2 fr= new Form2();
fr.Show();
}
}
{
MessageBox.Show("Ctrl+Shift+V");
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control)
{
Form2 fr = new Form2();
fr.Show();
}
}
}
}按住Ctrl +A弹出Form2窗体