Typically, in practice, this is much more easy than that. You usually don't need to write any code.
Let's take your bitmap. Create an new
.resx
file, open it, go to the menu on top and click "Resources"... "Add existing file". Browse and load the bitmap file, say "MyPicture.png". It will add a copy of "MyPicture.png" to your project and a link to this file in your resource.
You resource will create two nodes in solution explorer:
.resx
file and its child node with auto-generated
.cs
file. Open this file, locate a static class and its static property with the name close to the name of your bitmap file, something like "MyPicture". This is your bitmap, a static property you should use to access your bitmap in your resource.
Use it!
Don't use ResourceManager or anything like that — it is already done for you!
[EDIT]
In connection to discussion:
If you need to read a nearly permanent file (like a resource, something not modified during run time), place it in executable directory or a relative path relative to the executable directory. Here is how to calculate it:
string exePath =
System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetEntryAssembly().Location);
—SA