Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何制作一个允许我像 ctrl+c 功能一样复制的按钮。我想选择富文本框的一部分,当单击按钮时,它会复制选定的部分。带格式化!
在按钮单击事件上,您应该执行以下操作:
if (richTextBox1.SelectionLength > 0) // Copy the selected text to the Clipboard Clipboard.SetText(richTextBox1.SelectedText, TextDataFormat.Text);