Forcing RichTextBox to ignore a key pressed

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!
 
O

ohadasor

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top