Hi all,
I have a dll which contains five resource images (gif and png) as
embedded resource, I am loading these resources from the dll into my main
application, I get all the resource names correctly from the resource dll
... after constructing 2 bitmaps this piece of code throws exception.
The exception stacttrace is
at Microsoft.AGL.Common.MISC.HandleAr(PAL_ERROR ar)
at System.Drawing.Bitmap._InitFromMemoryStream(MemoryStream mstream)
at System.Drawing.Bitmap..ctor(Stream stream)
at MELFO_eLearning.MainForm..ctor()
at MELFO_eLearning.Program.Main()
Code:
Assembly asm = Assembly.LoadFrom("appres.dll");
string[] resNames = asm.GetManifestResourceNames();
Bitmap[] resBmps = new Bitmap[resNames.Length];
for (int i = 0; i < resNames.Length; i++)
{
try
{
Stream stream = asm.GetManifestResourceStream(resNames[i]);
resBmps[i] = new Bitmap(stream);
}
catch (Exception ex)
{
MessageBox.Show(ex.StackTrace);
}
}
Any ideas, please ????