Hello,

I program a user control which display a RichTextBox and a format
ToolStrip.
I want to process some shortcut keys.
The RichTextBox accepts tab.
Ctrl + I is supposed to format the selection in italic.
But Ctrl+I is also de code for Tab.
So when I press Ctrl+I, a tab is inserted (replacing the current
selection) AND the new selection is formatted in italic.

How can I do this ? Do I have to inherit first the standard RichTextBox
and override the OnKeyDown method ?

--
Fred
foleide@free.fr

Re: Tab and Ctrl+I in a richtextbox by Fred

Fred
Sat Mar 08 08:05:29 CST 2008

Dans : news:eXL2QNSgIHA.4376@TK2MSFTNGP05.phx.gbl,
Fred disait :
> Hello,
>
> I program a user control which display a RichTextBox and a format
> ToolStrip.
> I want to process some shortcut keys.
> The RichTextBox accepts tab.
> Ctrl + I is supposed to format the selection in italic.
> But Ctrl+I is also de code for Tab.
> So when I press Ctrl+I, a tab is inserted (replacing the current
> selection) AND the new selection is formatted in italic.
>
> How can I do this ? Do I have to inherit first the standard
> RichTextBox and override the OnKeyDown method ?

Of course not, just have to set the SuppressKeyPress property of the
KeyEventArgs parameter to false !!!

--
Fred
foleide@free.fr