2008-11-11 53 views
2

我在.NET WinForms中有一個RichTextBox。我一直在用KeyUp連接熱鍵。一切工作正常,除了CtrlI。當我的處理程序輪到時,選擇已被替換爲'\ t'。我關閉了ShortcutsEnabled,但它沒有任何區別。有任何想法嗎?RichTextBox CtrlI

回答

1

做這樣的:

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); 
    } 
} 
+0

謝謝,沒有的伎倆! – 2008-11-12 15:55:34