编程语言
首页 > 编程语言> > C#按Enter键自动触发下一控件

C#按Enter键自动触发下一控件

作者:互联网

在keypress事件中

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

 

标签:控件,Handled,C#,KeyChar,System,private,Enter
来源: https://www.cnblogs.com/WP-WangPin/p/13905034.html