在c#程序中展示嵌入的RTF文件是相当容易的--在Windows表单的富文本控件里(RichTextControl).

 首先,添加一下引用:

1  using System.IO;  

2  using System.Reflection;

 

其次,加载这个你嵌入到你项目中的RTF文件。

 

1在C#中展示嵌入的RTF文件Assembly asm = Assembly.GetExecutingAssembly();

2在C#中展示嵌入的RTF文件Stream stream =   asm.GetManifestResourceStream( "MyNamespace.FileName.rtf" ); 

 3 RichTextBox rt = new RichTextBox();

4 rt.LoadFile( stream, RichTextBoxStreamType.RichText );

 

 在这里加载嵌入的资源文件最重要就是得到正确的路径。

 

相关文章:

  • 2021-07-28
  • 2022-03-07
  • 2021-05-04
  • 2021-09-18
  • 2022-03-05
  • 2022-02-10
猜你喜欢
  • 2021-07-05
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案