using System.Windows.Formsrichtextbox 中怎么插入字符串, 我用richtextbox.text.insert怎么不行啊..不能用appendtext,那个太麻烦

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/4351/4351576.xml?temp=.3618128
      

  2.   

    用他的Lines属性这样赋值,怎么结果不变呢?
    源玛如下:
    private void EnterKeyEvent(System.Windows.Forms.KeyEventArgs e)
    {
          string strContent = "";
          string strSelected = "";
          int iLineIndex = 0;      strContent = GetCurLineString(out iLineIndex);                         
          if(listBox1.Items.Count !=0 || listBox1.Visible == false)
          {
    strSelected = this.listBox1.Items[0].ToString();         try
    {
          if(strContent.IndexOf("(") != -1)       {
    this.richTextBox1.Lines[iLineIndex] = "";
    this.richTextBox1.Lines[iLineIndex] = strContent + strSelected;
    //this.richTextBox1.Text.Insert(0, strContent + strSelected);
          }
          else
          {
    this.richTextBox1.Lines[iLineIndex] = "";
    this.richTextBox1.Lines[iLineIndex] = strSelected;   //this.richTextBox1.Text.Insert(0, strSelected);
          }
    }
    catch(Exception E)
    {
    MessageBox.Show(E.ToString());
    }
    this.listBox1.Items.Clear();
    listBox1.Visible = false;
    //SendKeys.Send("{BS}");      //one BACKSPACE
    bEnter = true;
       }
        else return;
    }
      

  3.   

    为什么我用richtextbox1.lines[iLineIndex] = "XXX";不行啊