把窗体的KeyPreview属性设为True
WebForm中:
private void Form9_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.Control && e.KeyCode==Keys.V)
{
MessageBox.Show("Ctrl+V");
}
}
1.Ctrl+Enter按键捕捉方法
<body onkeydown="doKeyDown()">
<script language="JavaScript">
<!--
function doKeyDown() {
if (event.ctrlKey && event.keyCode == 13) {
alert("You pressed the Ctrl + Enter")
}
}
//-->
</script>
</body>
2.Alt加快捷键: Alt+A
<button accessKey=A title="Alt+A" onclick="alert('Button clicked!')">Alt+A</button>