why when I press a Ctrl+Tab in a MultiLine TextBox,it enters a tab character, even i set the AcceptsTab property to false
Why does pressing Ctrl开发者_JAVA百科+Tab in a MultiLine TextBox
enter a tab
character even though I set the AcceptsTab
property to false
?
I set the MultiLine
property to true
and the AcceptsTab
property to false
.
The Ctrl-tab key press is treated differently from a tab key press. If you handle the Ctrl-tab in your TextBox_KeyDown
event, you can ignore it:
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.Tab)
e.Handled = true;
}
精彩评论