I've seen some topics on this subject but none of them wants to work in my case. In my Windows Forms app I have a ordinary Resources
catalog containing some images and .rtf
files. It looks like this:
There's no problem for me to load pictures from it as:
Bitmap bmp = Properties.Resources.Cut_6523;
But, for some reason, I am unable to do the same with .rtf
files (only bitmaps are available).
What am I doing wrong?
When you store a .rft
file as resource using resource designer, the resource designer creates a string
property for it that returns rich text.
So you can set the content of RichTextBox
to rich text using SelectedRtf
property.
this.richTextBox1.SelectAll();
this.richTextBox1.SelectedRtf = Properties.Resources.YourRTFResourceName;
Also as another option, you can cache that resource as a file in your application directory at run-time and then use richTextBox1.LoadFile
to load rich text.