首页 > 技术文章 > C# WinForm textbox 全选

guxingy 2018-08-17 16:43 原文

原地址:忘了

textBox1.KeyPress += anyTextBox_KeyPress;
private void anyTextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
    if (e.KeyChar == '\x1')
    {
        ((TextBox)sender).SelectAll();
        e.Handled = true;
    }
}

 

推荐阅读