我想请问一下 在C# winfrom 里面 如何获取文本框内已经选中的部分 
比如说 我用程序 打开一个文本文件 将文本文件内的内容 放到一个文本框里面,然后用鼠标选中其中的一段文本 点击一个按钮,程序会将我 已经选中的部分截取出来 放入STRING中

解决方案 »

  1.   

            private void button1_Click(object sender, EventArgs e)
            {
               textBox2.Text= textBox1.SelectedText.ToString();
            }
      

  2.   

     截取的内容放入到变量
          private void button1_Click(object sender, EventArgs e)
            {
               string txt;
               txt = textBox1.SelectedText.ToString();
            }