c# 怎样实现文本筐中 文本粘贴复制功能!!

解决方案 »

  1.   

    private void button1_Click(object sender, EventArgs e)
            {
                IDataObject data =Clipboard.GetDataObject();
                if (data.GetDataPresent(DataFormats.Text))
                {
                    textBox1.Text = data.GetData(DataFormats.Text).ToString();
                }
            }
      

  2.   

    private void textBox1_Enter(object sender, System.EventArgs e)
    {
       textBox1.SelectionStart = 0;
       textBox1.SelectionLength = textBox1.Text.Length;
    }//全选文本框内容
    string MySelectedText=this.textbox1.SelectedText;
    if(MySelectedText.Length<1)
    {
    MessageBox.Show("请首先选择文本!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
    return;
    }
    //复制文本到系统剪贴板
    Clipboard.SetDataObject(MySelectedText);
    IDataObject MyData=Clipboard.GetDataObject();从剪巾板中获取数据
      

  3.   

    已得正解
    其实
    TextBox
    就有Past()和Copy()方法
    直接调用就OK
    还是多谢各位