Processing "Control + C" keys in RichTextBox.KeyDown()

  • Thread starter Thread starter Robe
  • Start date Start date
R

Robe

Hi there,

I'm using a RichTextBox to create a custom editor, my class inherits from
it. I've set to false the property ShortcutsEnabled and I need to handle the
combination of keys Control + C. I've tried it in many ways using the
modifiers of the KeyEventArgs, using GetKeyboardState(), using GetKeyState()
in the RichEdit KeyDown event but it doesn’t work.

I think the problem is that when the user press both keys the event is not
fired for some reason, because if I check for the control key only it works
and the same for the C key but when both are pressed it doesn’t work.

Can someone explain me why this is happening?
How can I handle these keys combination?

Thank you in advance,

Robe.
 
Robe said:
Hi there,

I'm using a RichTextBox to create a custom editor, my class inherits from
it. I've set to false the property ShortcutsEnabled and I need to handle the
combination of keys Control + C. I've tried it in many ways using the
modifiers of the KeyEventArgs, using GetKeyboardState(), using GetKeyState()
in the RichEdit KeyDown event but it doesn’t work.

I think the problem is that when the user press both keys the event is not
fired for some reason, because if I check for the control key only it works
and the same for the C key but when both are pressed it doesn’t work.

Can someone explain me why this is happening?
How can I handle these keys combination?

The KeyEventArgs passed to your KeyDown event handler includes modifier
key state. So if you're having trouble, it's because your event handler
isn't written correctly.

For more specific advice on in what way your event handler isn't written
correctly, you will at a minimum need to post that event handler. For
best results, post a concise-but-complete code example that reliably
demonstrates the problem.

Pete
 
Back
Top