I have two RichTextBoxes (input and output). If I copy text with color from output and paste into input, the color of the text gets pasted as well. Is it possible to make the input-TextBox ignore formatting upon paste? I don't want colored text in the input-TextBox.
Asked
Active
Viewed 875 times
0
-
Windows Forms or WPF? Do you just care about ctrl+V or pastes performed via the integrated menu? – Alex K. Aug 18 '17 at 16:07
-
Usually ctrl+shift+V does unformatted paste. Not sure it works for RichTextBoxes on your platform (whatever that is), but it's worth a try. – icebat Aug 18 '17 at 16:13
-
Windows Forms. I usually just do ctrl+c, ctrl+v - so I guess that's all I care about. Would be nice to have complete coverage, though. I was hoping there was a property that could be set to 'False' to solve this. I tried using ctrl+shift+c / v, it didn't work. (It still pasted the color.) – Aug 18 '17 at 16:17
-
1Detect a paste: https://stackoverflow.com/questions/5618162/detecting-if-paste-event-occurred-inside-a-rich-text-box then change the content to text: https://stackoverflow.com/questions/2037827/c-sharp-rtb-paste-plain-text-without-colours-fonts. For full coverage you would need to handle the WM_PASTE sent to the RTBs parent. – Alex K. Aug 18 '17 at 16:32