先写到记事本,然后保存到程序运行的位置。\bin\Debug  或者\bin\Release
 然后在显示的代码是:            string strStartPath = Application.StartupPath;
            string strTxt = Path.Combine(strStartPath, "Help.txt");
            FileStream fs = new FileStream(strTxt, FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs, Encoding.Default);
            this.richtextbox1.Text = sr.ReadToEnd();treeview的AfterSelect的事件的代码如下:int i = rtbHelptxt.GetFirstCharIndexFromLine(this.rtbHelptxt.GetLineFromCharIndex(this.rtbHelptxt.Find(e.Node.Text)));
this.rtbHelptxt.Select(i, 0);
this.rtbHelptxt.ScrollToCaret();

解决方案 »

  1.   

    int i = rtbHelptxt.GetFirstCharIndexFromLine(this.richtextbox1.GetLineFromCharIndex(this.richtextbox1.Find(e.Node.Text)));
    this.richtextbox1.Select(i, 0);
    this.richtextbox1.ScrollToCaret();
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using System.Xml;
    using System.Reflection;
      

  3.   

    点节点获取文件路径,richtextbox.loadFile()直接加载文件不就行了,
    还用文件流读什么啊?