Assuming WinForms: try this: define a RichTextBox with a KeyDown event handler as follows:
Example to add only:
private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.V) { richTextBox1.Text += (string)Clipboard.GetData("Text"); e.Handled = true; } }
[Change]
Add RTF clipboard to RichTextBox at current insertion point (selection example):
private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.V) {
[Editing the end]
Note 0: the nested text will accept the current style settings for the RichTextBox: if you have the ForeGround color set to βBlueβ: the nested text will be blue.
Note 1: This is what I quickly knocked down and checked only a few times, creating several multi-colored and strangely formatted RTFs for the clipboard using WordPad: then pasting into RichTextBox1 at runtime: open all color, indentation, etc.
Since it is not fully tested, use caution.
Note 2: This will not handle the βPasteβ or βPaste through the context menuβ case, obviously.
We welcome all critical comments on this issue and immediately remove it if it is not "by sign".
Billw source share