WinForm textbox 全选

原地址:忘了

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;
    }
}

猜你喜欢

转载自www.cnblogs.com/guxingy/p/9494159.html