locked
How do I extract the images from a ImageList component? RRS feed

  • Question

  • hi there,

    I downloaded a sample tool which contains an ImageList component.
    When I click on properties of this ImageList component I see 3 images which I am trying to save it to disk so that I can use it in another control. Not sure how I can get them. If I ckick "Add" member I can see various formats such as bmp or gif but in the source code I dont see any images.

    Can you help?
    Thank you.



    JCDS
    Tuesday, June 23, 2009 4:39 PM

Answers

  • Hi,

    Is the tool a managed application?

    Please try the code bellow:

                Bitmap b = new Bitmap(this.imageList1.Images[0]);
                b.Save("1.bmp");

    Then other images can be aquired through different index.
    I assume the name of the imagelist is imageList1.

    Harry
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Maximusdm Tuesday, June 30, 2009 2:44 PM
    Tuesday, June 30, 2009 8:16 AM

All replies

  • Look up the type in the Object Browser Window to see all of the members for the type.

    The Forms.ImageList class contains an Images property which is a collection of type ImageListCollection. 
    Look that one up, too.  Are you familiar with the type List<T>?


    Mark the best replies as answers. "Fooling computers since 1971."
    Tuesday, June 23, 2009 5:54 PM
  • yes i am familiar with the type List<T>. I think that is like a dictionary. Sorry beginner here.
    I am not sure how to save those images into a bmp file though

    thanks
    JCDS
    Tuesday, June 23, 2009 11:36 PM
  • Hi,

    Is the tool a managed application?

    Please try the code bellow:

                Bitmap b = new Bitmap(this.imageList1.Images[0]);
                b.Save("1.bmp");

    Then other images can be aquired through different index.
    I assume the name of the imagelist is imageList1.

    Harry
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Maximusdm Tuesday, June 30, 2009 2:44 PM
    Tuesday, June 30, 2009 8:16 AM
  • that is exactly what I needed!

    Thank you Harry!!!!

    JCDS
    Tuesday, June 30, 2009 2:45 PM