0

I downloaded an existing RTF Editor custom user control from http://www.workaholic.hu/temp/RTFEditor.zip which I then upgraded to .Net 5.0 following this guide after checking using compatibility analyzer and it works as it did before..

I added that project to my solution and when I view the custom control in the VS Designer window in it's proect everything looks fine, all of the toolstripbuttons have their respective images.

But when I run my own application none of the images show up. I have stepped through the code and it seems to be loading the bitmaps ok, the bitmap property on the following line shows height and width of 16, they just show up wrong.

This is how the images are applied inside InitializeComponent

this.tsOpen.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;            
this.tsOpen.Image = global::Workaholic.RTFEditor.Properties.Resources.open;

Note, Workaholic is their namespace not mine.

The only thing I'm doing that's non-standard is dynamically loading instances of this control at runtime rather than adding it at design time, but the reference to it is statically linked as normal.

InitializeComponent is being called though as expected as I can break in it and inspect that it is indeed loading the images from its Resource file.

In this image, top is how it's displayed when I run my project and bottom is how it displays in the designer.

If I manually add it to the form in my very basic project the display is the exact same in design view as when I run it.

Jay Croghan
  • 445
  • 3
  • 16
  • Please re-read [MCVE] guidance and [edit] the question with necessary information. Make sure to start with clean project and double check that without your "non-standard is dynamically loading" part it works. – Alexei Levenkov Dec 01 '20 at 05:40
  • @AlexeiLevenkov I started with a clean project, if I use the original downloaded zip or my newly upgraded to .Net 5.0 version, both are fine in their own project design view but both look the same when added to a new blank form in a new blank project, all of the images are not the same as in the image I linked to. I'm not sure how I can have a reproducible example, attach a zip of the solution? I'm literally only placing the user control on the form... – Jay Croghan Dec 01 '20 at 07:03
  • With some more iterations you may be able to clean up problem enough so code is inline in the question (as required for debugging question). It is not clear from your comment if original random source you downloaded is even working correctly or not, but it feels like that should narrow down to one of two things - either your conversion broke things or your assembly loading code... Debugging where images are obtained from should let you narrow down even more to probably small enough code to fit into question... – Alexei Levenkov Dec 01 '20 at 07:19
  • There isn't anymore code for displaying the images, all of them are being defaulted to image that doesn't exist within any project. When the resource images can't be found, VS gives 'file not found' errors, not default images like in the link I provided. If you clicked the link you'd see how odd it is. They are only set on the lines I provided above. There really isn't anymore code to show... – Jay Croghan Dec 01 '20 at 10:41

0 Answers0