The class
RichTextBox
supports only RTF format, and pretty purely. There is a dirty way to insert a picture in it using clipboard:
For example:
Image img = Image.FromFile("myImage.jpg");
Clipboard.SetImage(img);
myRichTextBox.SelectionStart = 0;
myRichTextBox.SelectionLength = 0;
myRichTextBox.Paste();
However, you can face too many problems with that.
I would advice you to use some alternative. Instead of Rich Text Format, you could use HTML. I would recommend this wonderful component offered in this CodeProject article:
A Professional HTML Renderer You Will Use[
^].
The work I referenced above is excellent! Why do you need such brain damage as RTF is you can use very rich HTML? The author of this work developed such a wonderful thing as a support for special URL schema to include images and other resources from the resource embedded in the executable. This is a nearly perfect method of presentation of structured read-only documents without using of the
WebBrowser
control.
One more alternative: use WPF. It has excellent support for Rich documents and XPS. Please see my recent answer on XPS viewer:
The XPS Document Viewer Sample In Intersoft ClientUI[
^].
—SA