1

So in my winforms project, I have a few Rich Text Box fields. I want to load some information into these fields from a file. The file can contain text, formats, tables, and even pictures.

So, everywhere I read, to load a Rich Text Box you have to code:

rtbPartPlayed.LoadFile(partPlayedFile, RichTextBoxStreamType.RichText);

However, in doing this, I get all the text, but none of the images.

If I do the reverse, and save what is in my rich text box field to a file with:

rtbPartPlayed.SaveFile(tmpPath + "\\" + gsPartPlayed + ".rtf", RichTextBoxStreamType.RichText);

It saves the images and all the data to file.

How can i get it to load with the images?

Thanks Bradley

  • Have you seen these QAs? https://stackoverflow.com/questions/34843931/readonly-content-of-richtextbox-doesnt-show-images and https://stackoverflow.com/questions/42278823/richtextbox-not-displaying-image – Dai Oct 19 '20 at 10:21
  • Curious: How did you get the images into your rtf control? – TaW Oct 19 '20 at 14:41
  • @TaW they where copied and pasted from other sources. – Bradley Wheeler Oct 20 '20 at 12:47
  • It may be interesting to look into the raw rtf to look for differences in how the images are stored there.. RTB is rather bad dealing with images, though. – TaW Oct 20 '20 at 15:04
  • @Dai I looked at your link, and it works. It is strange that a RTF will only load the images when readonly is false. But works. Thank you. – Bradley Wheeler Oct 21 '20 at 06:30

0 Answers0