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 @   WP-WangPin  阅读(125)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示