openFileDialog1.CheckFileExists=true;
openFileDialog1.CheckFileExists=true;
openFileDialog1.Multiselect=false;
openFileDialog1.Filter="文件类型(*.txt)|*.txt";
openFileDialog1.Title="请选择一个RTF格式文件";
openFileDialog1.InitialDirectory="C:";
openFileDialog1.ShowReadOnly=true;
openFileDialog1.ReadOnlyChecked=true;
openFileDialog1.ShowHelp=true;
if((this.openFileDialog1.ShowDialog()==DialogResult.OK)
&(openFileDialog1.FileName.Length>0))
{
try
{
this.richTextBox1.LoadFile(this.openFileDialog1.FileName);
}catch{}
if(this.openFileDialog1.ReadOnlyChecked=true)
{
this.richTextBox1.ReadOnly=true;
}
else
{
this.richTextBox1.ReadOnly=false;
}
openFileDialog1.CheckFileExists=true;
openFileDialog1.Multiselect=false;
openFileDialog1.Filter="文件类型(*.txt)|*.txt";
openFileDialog1.Title="请选择一个RTF格式文件";
openFileDialog1.InitialDirectory="C:";
openFileDialog1.ShowReadOnly=true;
openFileDialog1.ReadOnlyChecked=true;
openFileDialog1.ShowHelp=true;
if((this.openFileDialog1.ShowDialog()==DialogResult.OK)
&(openFileDialog1.FileName.Length>0))
{
try
{
this.richTextBox1.LoadFile(this.openFileDialog1.FileName);
}catch{}
if(this.openFileDialog1.ReadOnlyChecked=true)
{
this.richTextBox1.ReadOnly=true;
}
else
{
this.richTextBox1.ReadOnly=false;
}