获得类似QQ的Ctrl+Enter按键操作
在事件private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)里面:
#region
if ((e.KeyChar==10))
{
MessageBox.Show("Enter OK");
button1_Click(null,EventArgs.Empty);
}
#endregion
在textBox1_KeyPress 触发button1_Click事件.
或者下面代码
#region
if ((e.KeyChar==10))
{
MessageBox.Show("Enter OK");
button1_Click(null,EventArgs.Empty);
}
#endregion
在textBox1_KeyPress 触发button1_Click事件.
或者下面代码
protected override bool ProcessDialogKey(Keys keyData)
{
//if (keyData ==(Keys.Control || Keys.Return))
if (keyData ==(Keys.Control | Keys.A))
{
fullScreenBtn_Click(null, EventArgs.Empty);
}
if (keyData == (Keys.Control | Keys.B))
{
mouseCaptureBtn_Click(null, EventArgs.Empty);
}
if (keyData == (Keys.Control | Keys.C))
{
ClearBtn_Click(null, EventArgs.Empty);
}
return base.ProcessDialogKey(keyData);
}
{
//if (keyData ==(Keys.Control || Keys.Return))
if (keyData ==(Keys.Control | Keys.A))
{
fullScreenBtn_Click(null, EventArgs.Empty);
}
if (keyData == (Keys.Control | Keys.B))
{
mouseCaptureBtn_Click(null, EventArgs.Empty);
}
if (keyData == (Keys.Control | Keys.C))
{
ClearBtn_Click(null, EventArgs.Empty);
}
return base.ProcessDialogKey(keyData);
}