C#按Enter键焦点跳到文本框

在keypress事件中

        private void richTextBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                textbox.Focus();
            }
            if (e.KeyChar == System.Convert.ToChar(13))
            {
                e.Handled = true;
            }
        }

 

posted @ 2020-10-31 02:33  WP-WangPin  阅读(122)  评论(0编辑  收藏  举报