Multiple image thumbnail viewer


  • I am trying to create a simple winform application in c# that can load multiple images from a file dialog into the application screen. I am using ListView control to contain those images as picture box control wasn't going to serve my needs as I want to be able to select loaded thumbnails and do many other things based on the selection.

    The problem I am having is to do with thumbnail image quality. Once they get loaded in the application window panel, the image quality is very poor. I want them to look just like how Windows operating system displays preview/thumbnails of images in large icon with a decent image quality.

    I've tried adding this listView1.LargeImageList.ColorDepth = ColorDepth.Depth32Bit; as suggested by other people but it won't even let the application load images.

    Here is the code done so far.

    using (OpenFileDialog open = new OpenFileDialog())
        open.Title = "Open Image";
        open.Filter = "JPEG Files (*.jpg)|*.jpg;*.jpeg|All Files (*.*)|*.*";
        open.Multiselect = true;
        if (open.ShowDialog() == DialogResult.OK)
            ImageList picList = new ImageList();
            listView1.View = View.LargeIcon;
            picList.ImageSize = new Size(200, 130);
            foreach (String file in open.FileNames)
                Image i = Image.FromFile(file);
                Image pic = i.GetThumbnailImage(200, 130, null, new IntPtr());
            listView1.LargeImageList = picList;
            listView1.LargeImageList.ColorDepth = ColorDepth.Depth32Bit;
            for (int i = 0; i < picList.Images.Count; i++)
                ListViewItem item = new ListViewItem();
                item.ImageIndex = i;

    Does anyone have any suggestions as to make it perform just as good as Windows' default thumbnail viewer
    where you have good quality thumbnail images and being able to select multiple of them.

    Thursday, April 04, 2013 9:54 PM


All replies