C#操作剪贴板实现复制粘贴
//粘贴 private void tsbPaste_Click(object sender, EventArgs e) { IDataObject iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Text)) { txtContent.Text = (String)iData.GetData(DataFormats.Text); } } //复制 private void tsbCopy_Click(object sender, EventArgs e) { if (txtContent.Text != "") { Clipboard.SetDataObject(txtContent.Text); MessageBox.Show("已复制到剪贴板!"); } }