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.
我的表单中有一个 TextEdit,我只想让用户复制它的包含而不是编辑它,如果我使用TextEdit.Enabled = false;我无法复制 TextEdit 的包含。
TextEdit.Enabled = false;
请问,我怎样才能让用户只复制文本。
试试TextEdit.Properties.ReadOnly = true。这应该有效。
TextEdit.Properties.ReadOnly = true
将该属性设置为true,并在表单中添加一个按钮来复制文本,并在事件处理程序ReadOnly中编写以下代码:button1_Click
ReadOnly
button1_Click
Clipboard.SetDataObject(richTextBox1.SelectedText);