Where can i Find a Example...
Ive not used Assembly before
thanks
> [icons and bitmaps in a DLL]
> Where can i Find a Example...
> Ive not used Assembly before
Well, here is a quick example if you just want to retrieve a bitmap. If
it's not enough, you should check the Visual Studio documentation and
also make sure you know about the Stream class.
using System.Reflection;
. . .
Bitmap b = (Bitmap) Bitmap.FromStream(
Assembly.GetExecutingAssembly().GetManifestResourceStream(
"MyNamespace.MyImageFilename.bmp"
));
This works if your code is in a namespace "MyNamespace" and you've added
a file "MyImageFilename.bmp" with Build Action set to "Embedded
Resource".
Eq.
Analizer1 - 04 Mar 2008 22:13 GMT
below is code i have working....
What if the icon/image is stored in another dll
How would i go about retrieving that icon/image
Assembly assembly = Assembly.GetExecutingAssembly();
// Retrieve a list of resource names contained by the assembly.
string[] resourceNames = assembly.GetManifestResourceNames();
foreach (string resourceName in resourceNames)
{
Console.WriteLine(resourceName);
}
// Retrieving an image resource follows the same principle.
string ResourceName = string.Format("{0}.{1}", assembly.GetName().Name,
"STOP.ICO");
Console.WriteLine(ResourceName);
using(Stream barStream = assembly.GetManifestResourceStream(ResourceName))
//barResourceName)))
{
using (Icon oIcon = new Icon(barStream))
{
Bitmap oBitmap = oIcon.ToBitmap();
this.pictureBox1.Image = oBitmap;
}
}
>> [icons and bitmaps in a DLL]
>> Where can i Find a Example...
[quoted text clipped - 15 lines]
>
> Eq.