I have a RichTextBox that I wish to fill with RTF text at design time. This does not mean doing this:
richTextBox1.Rtf = @"<a bunch of rich text>";
which actually assigns the value at run time (or does it?).
I have created a project resource file called "TextResources.resx" with a resource named InstructionsRTF with a Value containing the rich text. How is this to be bound to the RichTextBox at design time?
Edited to add:
@hans-passant is correct, although the exact code I ended up using differs somewhat:
rtfInstructions.Rtf = TextResoures.InstructionsRTF;
where TextResources is the TextResources.resx in the project.
RichTextBox doesn't support binding. If it is already a precooked resource then trying to support this at design time doesn't make sense. It is just one line of code in the form constructor:
public Form1() {
InitializeComponent();
richTextBox1.Rtf = Properties.Resources.instructionsRTF;
}
If you want to get more adventurous at design time then that's possible too. You can create a UITypeEditor that lets you edit the RTF at design time. Code is here.