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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Icons From ImageList

Status
Not open for further replies.

apc2003

Programmer
Aug 29, 2003
54
GB
I have an ImageList with a collection of 8 Icons ranging from position 0-7.

I am trying to create a new instance of an Icon from a position in the ImageList.

Code:
Icon myIcon = new Icon(imageList1.Images[0])

This code wont work but I believe it may be the basis of the answer, I can't seem to get the syntax correct and get errors relating to converting image to icon.

Can anyone suggest a simple answer to this prob?

Thanx in advance...
 
An Icon object could be constructed from another one Icon object, from a Stream or from a string that point to a resource in your assembly.
If you added an Icon object to the imageList1 object then it was converted to a Bitmap before storing it.
When you use imageList1.Images[0] ; you retrieve an Image object and you cannot convert it to an Icon or to a Bitmap because there are no such operators.
-obislavu-
 
Oh right, well in that case, is there any way to add icons to a .dll or some resource file so as i can call them from there as opposed to calling them direct from a folder location?

If so how do i do this as i am totally in the dark when it comes to resouce files and .dll's etc...

Again thanx in advance...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top