先写到记事本,然后保存到程序运行的位置。\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();
然后在显示的代码是: 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();
this.richtextbox1.Select(i, 0);
this.richtextbox1.ScrollToCaret();
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;
还用文件流读什么啊?