开发者

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜