I have a RichTextBox in .NET WinForms. I have been hooking up hot keys with KeyUp. Everything is working fine, except for CtrlI. By the time my handler gets its turn, the selection has been replaced with a '\t'. I turned off ShortcutsEnabled, but it didn't make any difference. Any ideas?
+1
A:
Do it like this:
using System;
using System.Windows.Forms;
public class MyRtb : RichTextBox {
protected override bool ProcessCmdKey(ref Message m, Keys keyData) {
if (keyData == (Keys.I | Keys.Control)) {
// Do your stuff
return true;
}
return base.ProcessCmdKey(ref m, keyData);
}
}
Hans Passant
2008-11-11 20:59:06
Thanks, that did the trick!
Jake Pearson
2008-11-12 15:55:34