Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I reference an Embedded Icon file for use in a ListView? 1

Status
Not open for further replies.

skhoury

IS-IT--Management
Nov 28, 2003
386
US
Hello all,

I have a project that i'm working on that includes some icon files. I'd like to compile the icon files directly into my DLL rather than simply reference a path to loose files.

So what I did was add the icon file to my project and selected its Build Action to be "Embedded Resource".

I've figured out how to load images into my ListView by using an ImageList and adding files to it via its properties.

So my question is this:

How can I add images into an ImageList that are Embedded Resources?

Any help is greatly appreciated!

Thanks,

Sam



How
 
You dont have to embed, then include in the image list. Just load them in the image list and it will take care of embedding them for you.
 
Hmm ok, so then this is what I did:

I created a new folder under my solution called Icons.
I added all the icons into this folder and set them to be Embedded Resources.

I then clicked on my ImageList in design view, went to its properties, clicked on Collections, and added the icons into it (by using a path name).

So...to test this, I moved the EXE and DLL to a separate directory and ran them and the Icons showed up.

But, I was still suspect about it, so I renamed the original directory that contained the icons and its still worked...great.

BUT, I still didnt trust it so, I ejected the flash drive that contained all my source code and icons, then ran exe from my desktop and...

It stopped working!! (i.e. icons didn't show up).

Isn't that wierd? Does anyone have any thoughts about this?

Thanks,

Sam
 
Woops my fault...I had another completely unrelated problem.

Embedding works now!

Thanks,

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top