It’s easy to display an RTF file — that was embedded as a resource in a C# program — in a Windows Form RichTextControl.

First, include the following references:

using System.IO;
using System.Reflection;

Next, load the RTF that you have embedded in your Visual Studio project:

Assembly asm = Assembly.GetExecutingAssembly();
Stream stream = asm.GetManifestResourceStream( "MyNamespace.FileName.rtf" );

RichTextBox rt = new RichTextBox();
rt.LoadFile( stream, RichTextBoxStreamType.RichText );

The trickiest part of loading an embedded resource is getting the correct path.  Check out this article if you are having trouble loading the embedded resource.

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot