开发者

How to override PASTE operations in ScintillaNet?

I am using the Scintilla control from ScintillaNet, and I need to have some control over the paste operations (in order to be able to check some things and/or update the text to be pasted).

I've tried to create a subclass of the Scintilla control and override the WndProc method. Then, I intercept the WM_PASTE message (0x0302), no luck. I never catch it.

Here is the code I use:

protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_PASTE)
    {
        MessageBox.Show("Paste");
    }
    base.WndProc(ref开发者_如何学JAVA m);
}

Any idea?


You could remove ScintillaNET's built in CTRL+V handler with:

scintilla.Commands.RemoveBinding(Keys.V, Keys.Control, ScintillaNet.BindableCommand.Paste);

And add your own CTRL+V handler (menu item?) to do a:

ScintillaNet.Selection.Text = your_processed_clipboard_data;

That would insert at the current cursor position, or replace the current selection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜