首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

向richtextbox中插入中文出现乱码的有关问题

2012-02-08 
向richtextbox中插入中文出现乱码的问题从codeproject下载了一段代码:publicvoidInsertLink(stringtext,st

向richtextbox中插入中文出现乱码的问题
从codeproject下载了一段代码:
public   void   InsertLink(string   text,   string   hyperlink,   int   position)
{
        if   (position   <   0   ||   position   >   this.Text.Length)
throw   new   ArgumentOutOfRangeException( "position ");

this.SelectionStart   =   position;
this.SelectedRtf   =   @ "{\rtf1\ansi   "+text+@ "\v   # "+hyperlink+@ "\v0} ";
this.Select(position,   text.Length   +   hyperlink.Length   +   1);
this.SetSelectionLink(true);
this.Select(position   +   text.Length   +   hyperlink.Length   +   1,   0);
}

结果在调用该方法并插入汉字时出现乱码,但是英文没有问题,请问是怎么回事?

[解决办法]
up

热点排行