/// <summary>
/// 复制
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCopy_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
Clipboard.SetDataObject(textBox1.Text);
}
}
/// <summary>
/// 粘贴
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPaste_Click(object sender, EventArgs e)
{
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text))
{
textBox2.Text = (String)iData.GetData(DataFormats.Text);
}
}
参考原文:http://www.2cto.com/kf/201011/78884.html