自动突出显示文本框控件中的文本
问题描述:
当控件获得焦点时,如何在文本框控件中自动突出显示文本。
How do you auto highlight text in a textbox control when the control gains focus.
答
在Windows Forms和WPF中:
In Windows Forms and WPF:
textbox.SelectionStart = 0;
textbox.SelectionLength = textbox.Text.Length;