To override command functions:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == (Keys.Control | Keys.C)) { //your implementation return true; } else if (keyData == (Keys.Control | Keys.V)) { //your implementation return true; } else { return base.ProcessCmdKey(ref msg, keyData); } }
And right-clicking is not supported in Winforms RichTextBox
- EDIT -
Implemented too late, this is a WPF question. To do this in WPF, you will need to add a special Copy and Paste handler:
DataObject.AddPastingHandler(myRichTextBox, MyPasteCommand); DataObject.AddCopyingHandler(myRichTextBox, MyCopyCommand); private void MyPasteCommand(object sender, DataObjectEventArgs e) {
Edwin de koning
source share