How to add PNG resource in Visual Studio 2010?
-
26-10-2019 - |
سؤال
I have a PNG (i.e. a compressed image) that I'd like to include in my assembly (i.e. application).
How to do it?
Additional information:
I tried adding a PNG resource to my assembly in Visual Studio 2010:
But that didn't work, as Visual Studio converts it to an uncompressed bitmap:
Except I want to add a PNG.
Otherwise my 1MB application becomes 8MB:
]=== 1MB file size ==>
]=== 8MB file size ==============================================================================================================================================>
المحلول
- Go to the project menu -> properties.
- Select the resources tab
- Make sure Images is selected first.
- Click the arrow beside 'add resource'
- New Image (Select from Image File Types)
- Find the PNG
نصائح أخرى
The only way I could make this work, is by removing the file extension from the PNGs. That way Visual Studio doesn't recognize the files as images, and leaves them untouched.
لا تنتمي إلى StackOverflow