S
Saurabh
Hi All,
I have a C# project, I added 2 bitmap images, 1.bmp and 2.bmp in the project
by right clicking and using the add existing item dialog. The bmp files now
appear in the solution explorer. My question is, do they get embedded in the
assembly? When I use the code as
System.Drawing.Bitmap b =
(System.Drawing.Bitmap)Bitmap.FromFile("c:\\myimages\\1.bmp");
it loads the bitmap and works fine. There are 2 things, I do not want to
hard code the path as somebody else might have the project somewhere else.
Ideally I would want to load the image from the assembly, but when I do
ResourceManager rm;
rm = new ResourceManager("<MyAssemblyName>",
Assembly.GetExecutingAssembly());
System.Drawing.Bitmap bt;
bt = (System.Drawing.Bitmap)rm.GetObject("1.bmp");
it does not load the bitmap. I think I am missing something very basic over
here. Can anybody point to what might be wrong?
TIA,
--Saurabh
I have a C# project, I added 2 bitmap images, 1.bmp and 2.bmp in the project
by right clicking and using the add existing item dialog. The bmp files now
appear in the solution explorer. My question is, do they get embedded in the
assembly? When I use the code as
System.Drawing.Bitmap b =
(System.Drawing.Bitmap)Bitmap.FromFile("c:\\myimages\\1.bmp");
it loads the bitmap and works fine. There are 2 things, I do not want to
hard code the path as somebody else might have the project somewhere else.
Ideally I would want to load the image from the assembly, but when I do
ResourceManager rm;
rm = new ResourceManager("<MyAssemblyName>",
Assembly.GetExecutingAssembly());
System.Drawing.Bitmap bt;
bt = (System.Drawing.Bitmap)rm.GetObject("1.bmp");
it does not load the bitmap. I think I am missing something very basic over
here. Can anybody point to what might be wrong?
TIA,
--Saurabh