我通过richtextbox的loadfile(stream, RichTextBoxStreamType)方法将一下*.rtf文件读入到richtextbox,其它没什么问题,但是当中的超级链接会将目的链接显示出来,但是我不想让它显示出来,不知道哪位大侠能帮帮忙,谢谢!具体如下: 以下是rtf文件中的超级链接: link loadfile以后就变成: link 但是我想的是loadfile以后还是: link
string x = richTextBox1.Rtf;
//找超链接
int a = x.IndexOf("HYPERLINK \"");
a+=(string)"HYPERLINK \"".Length;
int b = x.IndexOf("\"}",a+1);
string temp = x.Substring(a, b - a);//提取http://www.163.com/
//找超链接文字
a = x.IndexOf("\\ul ", b + 2);
a+=(string)"\\ul ".Length;
b = x.IndexOf("}", a);
string ok;
if ((x.Substring(a, b - a).Contains(temp)) &&( x.Substring(a, b - a).Length>temp.Length))
{
ok = x.Substring(0, a) + x.Substring(a, b - a - temp.Length) + x.Substring(b);//删除重复的http://www.163.com/
}
string x = richTextBox1.Rtf;
//找超链接
int a = x.IndexOf("HYPERLINK \"");
a+=(string)"HYPERLINK \"".Length;
int b = x.IndexOf("\"}",a+1);
string temp = x.Substring(a, b - a);//提取http://www.163.com/
//找超链接文字
a = x.IndexOf("\\ul ", b + 2);
a+=(string)"\\ul ".Length;
b = x.IndexOf("}", a);
string ok;
if ((x.Substring(a, b - a).Contains(temp)) &&( x.Substring(a, b - a).Length>temp.Length))
{
ok = x.Substring(0, a) + x.Substring(a, b - a - temp.Length) + x.Substring(b);//删除重复的http://www.163.com/
}