我在窗口中有几个text控件,我想按回车来控制焦点的转移,我在什么事件中写,怎么写

解决方案 »

  1.   

    奇怪的要求,为什么不用tab键?
      

  2.   

    在Text控件的KeyPres事件里加上
    if(e.KeyChar==(char)13)
    {
     System.Windows.Forms.SendKeys.Send("{TAB}");
     e.Handled=true;
    }
      

  3.   

    在KeyPress事件中
    private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    {
    if(e.KeyChar==(char)13)
    {
    this.textBox2.Focus();
    }
    }
      

  4.   

    System.Windows.Forms.SendKeys.Send("{TAB}");
     e.Handled=true;这两句能不能说清楚一点?
     具体一点。
      

  5.   

    System.Windows.Forms.SendKeys.Send("{TAB}");
    是说,但有回车键是,向系统发送一个TAB键,这样回车就变成了TAB,实现目的了。e.Handled=true 是说获得句柄。