Retrieving Images from a Zip File

In this example, two buttons and a listbox will be used to show how images can be retrieved from a .zip file.

To retrieve images directly from a zip file, first add the following code to compress several image files into a zip file. In this example, the code is added to the btnNew_Click event, which creates a new .zip file for the images when a button is clicked.

      C#

 

Then use the following code to add image files to a list in the ListBox.

      C#

To allow you to select an image, retrieve a stream with the image data (OpenReader method), and add the following code to the listBox1_SelectionChanged and StreamCopy events:

      C#

 

This topic illustrates the following:

This example shows several types of images, including ICO, TIFF, BMP, and JPG images.

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.