private void checkBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar==13)
            {
                this.checkBox1.Checked = true;
                
            }
        }        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Test");
        }这样  按ENTER
就只有 MessageBox.Show("Test");了 
能不能  先有 this.checkBox1.Checked = true;  再 MessageBox.Show("Test");呢
那位能给点意见吗 谢谢回复   

解决方案 »

  1.   

    checkBox1_KeyPress 绑定到OnKeyPress事件上了么?你敲回车,怎么可能会是click呢?click是鼠标的事件,不是键盘的事件。
      

  2.   


            private void checkBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == 13)
                {
                    checkBox1.Checked = true;
                    EventArgs xe = new EventArgs();
                    btn_ShowMess_Click(sender, xe);
                    //return;
                }
            }        private void btn_ShowMess_Click(object sender, EventArgs e)
            {
                MessageBox.Show("Test");
            }
    这样吧