c# 实现复制粘贴功能,求解!
如何把字符串放到系统的粘贴板中,然后他在别的地方ctrl+v再粘贴出来实现复制粘贴功能!
大神们,该怎么做啊?
------解决方案-------------------- 在Windows窗体中添加了一个TextBox,一个MenuStrip控件(添加了四个子项复制粘贴剪切撤销)
C# 实现复制,粘贴,剪切,撤销
using System;
using System.Windows.Forms;
namespace ClickEvent
{
   public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
       }
       private void Menu_Copy(System.Object sender, System.EventArgs e)
       {
           //确保文本在文本框中已经选定  
           if (textBox1.SelectionLength > 0)
               // 复制文本到剪贴板
               textBox1.Copy();
       }
       private void Menu_Cut(System.Object sender, System.EventArgs e)
       {
           // 确保当前文本框中有选定
           if (textBox1.SelectedText != "")
               // 剪切选定的文本至剪贴板
               textBox1.Cut();
       }
       private void Menu_Paste(System.Object sender, System.EventArgs e)
       {
           // 判断剪贴板中是否有文本
           if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true)
           {
               // 判断文本框中是否有文本选定了
               if (textBox1.SelectionLength > 0)
               {
                   // 询问是否覆盖选定的文本
                   if (MessageBox.Show("你想覆盖选定的文本吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No)
                       // 移动选定文本的位置,即之前选定文本的起始+选定文本的长度
                       textBox1.SelectionStart = textBox1.SelectionStart + textBox1.SelectionLength;
               }
               // 将剪贴板中的文本粘贴至文本框
               textBox1.Paste();
           }
       }
       private void Menu_Undo(System.Object sender, System.EventArgs e)
       {
           // 决定文本框最后的操作是否能撤销  
           if (textBox1.CanUndo == true)
           {
               // 撤销最后的操作
               textBox1.Undo();
               // 从该文本框的撤消缓冲区中清除关于最近操作的信息。
               textBox1.ClearUndo();
           }
       }
   }
}
------解决方案-------------------- C# code
            var text = "???";
            System.Windows.Forms.Clipboard.SetText(text);
------解决方案--------------------  http://topic.csdn.net/u/20080730/14/065d4e29-dc6f-4f72-a408-f85ce4608846.html
------解决方案--------------------  探讨  在Windows窗体中添加了一个TextBox,一个MenuStrip控件(添加了四个子项复制粘贴剪切撤销) C# 实现复制,粘贴,剪切,撤销 using System; using System.Windows.Forms; namespace ClickEvent {   public partial class Form1 : Form   {   public Form……