Here’s one of the ways to embed an image into EXE file:
- Left click the file in the project tree
- Set
Build Action
->Embedded Resource
.
And how you can access this file in code:
|
|
It’s the shortest piece of code I found on the net. And it works, even for GIFs with transparent backgrounds, which is what I needed it for.
Parameter Name
should be a fully qualified name of the file you are referring to (Namespace + file name). If your project’s name is MyApplication1
, chances are that you need something like MyApplication1.SomePicture.gif
.