Filling an ImageList in a ClassLibrary (DLL)?

  • Thread starter Danyel Meyer - dialog-it GmbH
  • Start date
D

Danyel Meyer - dialog-it GmbH

Hallo group!

I just had the idea to put some images into a class library that should just
expose an ImageList object to an application that needs to load images from
it.
My thought was to embedd the images to a DLL and fill an ImageList object
with them, but I can´t figure out how to do that.
I have tried to load an image into my class library project as an "embedded
ressource", but then I have difficulties adding it to the ImageList, because
I don´t find a possibility to cast a file stream to an image.
Another solution would be to use a ressource-file, but here I can´t find out
how to add images to such a file.
I was not able until now to find any example code that works for me.

Any idea on how to do this? Or maybe any solution I have not thought about
yet? Although VB.NET would be quite nice, I should be able to understand C#
as well ;)

Many thanks in advance,

--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine

Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail (e-mail address removed)
 
D

Danyel Meyer - dialog-it GmbH

Okay, it works... a little bit at least ;)

I use embedded ressources and get their contents with
GetManifestRessourceStream. But I´ve found another difficulty:

How can I influence the order in wich the embedded files are sorted? I have
tried to add them to my project the order I´d like to have them there, but
when I read them, their order was tumbled. I cannot figure out wich criteria
tells VS.NET in wich order to hadle the files, it´s not the file name, not
the size...

Any help?


--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine

Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail (e-mail address removed)
 
X

Xin Yan

Hi, Danyel,
Once you added your image files to your project as embedded resources, you
can retrieve them by name. For example, file a.bmp is named as
SmartDeviceApplication1.a.bmp and you can use GetManifestRessourceStream to
retrieve it.
Hope this helps.
Xin
 
D

Danyel Meyer - dialog-it GmbH

Hi Xin.

I known how to retrieve an image from an embedded ressource. My question was
how to determine the order in wich the images are embedded at design time.
My library should be used by our developers, and they should have a
possibility to select wich image they want to use at design time by simply
selecting something from an enumeration. Therefore I need to know the order
in wich images are stored when embedding them.

But thanks for your try :)


--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine

Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top