Friday, September 7, 2018

Where does my WinForms app store my images?

You don't have to keep the images in the UI project like you might with a web forms app. Instead you will find yourself dragging a PictureBox control out of the Common Controls in the Toolbox and into a WinForm and then clicking upon the little arrow in it to browse for an image. A continued reference to the image source is not needed because a string-full-of-gunk representation of the image is tucked away to a .resx file associated with the WinForm. (There will be a .cs file, a .Designer.cs file, and a .resx file with the same name beyond the file extension.)

 
 

Addendum 9/17/2018: When you add an image through the GUI, you will be given an option for Local Resource (which is probably what you want) and an option for Project Resource File. The second option will tuck away the image to a different .resx elsewhere, not one tied to your WinForm.

No comments:

Post a Comment