Forcing RichTextBox to ignore a key pressed

  • Thread starter Thread starter Udi
  • Start date Start date
U

Udi

Hi all,
I have a derived class from RichTextBox.
I'm overriding IsInputKey() to deal with my speciffic keys.
I'm catching Keys.Space | Keys.Control when the user presses
Ctrl+space,
however, I don't want my derived control printing the 'space' charecter
in this situation.
returning false from IsInputKey() solve this issue but it is not good
for me because I'm losing the text box focus in this case.
What do I do then?

Thanks!
 
If you are using .NET Framework 2.0, then on KeyEventArgs (the second
parameter of KeyDown or whatever event you handle), there is a member
called SuppressKeyPress.
Set it to true.

I hope it works.
 
Back
Top