When using shortcut keys in the TextBox control, it is generally required to press the shortcut key to produce an effect immediately. The KeyUp event obviously does not meet our requirements, and the KeyPRess event does not support the use of assemblies, so we choose the KeyDown event. The specific code implementation is as follows : private void tBBefore_KeyDown( object sender, KeyEventArgs e){ if (e.Co
When using shortcut keys in the TextBox control, it is generally required to press the shortcut key to produce an effect immediately. The KeyUp event obviously does not meet our requirements, and the KeyPRess event does not support the use of assemblies, so we choose the KeyDown event. The specific code implementation is as follows :
<span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> tBBefore_KeyDown(<span style="color: #0000ff">object</span><span style="color: #000000"> sender, KeyEventArgs e) { </span><span style="color: #0000ff">if</span> (e.Control && e.KeyCode ==<span style="color: #000000"> Keys.A) { ((TextBox)sender).SelectAll(); } }</span>