获得类似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事件.

或者下面代码
  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); 
        }

posted @ 2005-01-07 11:10  jhtchina  阅读(1940)  评论(1编辑  收藏  举报