问题
How do I make a button that allows me to copy like the ctrl+c function. I want to select a part of a rich text box and when the button is clicked it copies the selected part. With formatting!
回答1:
On button click event you should do something like:
if (richTextBox1.SelectionLength > 0)
// Copy the selected text to the Clipboard
Clipboard.SetText(richTextBox1.SelectedText, TextDataFormat.Text);
来源:https://stackoverflow.com/questions/18443411/c-sharp-copy-function-richtextbox-with-formatting