private void DisplayPicSet(int i)
 {
     ic.SetGen(i - iCurPic); //Set generation
     ic.Rinse(3, ImageCollection.imType.Resized);
     for (int a = 0; a < 3; a++)
     {
         if (id.Length > i + a)
         {
             ic.Add(id[i + a].sHash, id[i + a].sPath,
                    +a, ImageCollection.imType.Resized);
         }
         if (i - a >= 0)
         {
             ic.Add(id[i - a].sHash, id[i - a].sPath,
                    -a, ImageCollection.imType.Resized);
         }
     }
     iCurPic    = i;       //Set new opened image
     bSetNewPic = true;    //We need to update display
     if (!DisplayPicSet()) //Image not in bm cache
     {
         ic.Prio(id[i].sHash, ImageCollection.imType.Resized);
         ic.Load();         //Prioritize and init load of opened image
     }
     pbDisp.Visible = true; //We are displaying an image
     ShowPanel(pnDisp);     //Show display in GUI
 }
        private void ShowPics(string[] sFiles)
        {
            bool[] bAdd = new bool[sFiles.Length]; int iAdd = 0;
            for (int a = 0; a < sFiles.Length; a++)
            {
                sFiles[a] = sFiles[a].ToLower();
                if (sFiles[a].EndsWith(".png") ||
                    sFiles[a].EndsWith(".jpg") ||
                    sFiles[a].EndsWith(".gif"))
                {
                    bAdd[a] = true;
                    iAdd++;
                }
            }
            int iCnt = 0;

            id = new ImageData[iAdd];
            for (int a = 0; a < sFiles.Length; a++)
            {
                if (bAdd[a])
                {
                    id[iCnt]       = new ImageData();
                    id[iCnt].sPath = sFiles[a];
                    id[iCnt].sHash = sFiles[a];
                    iCnt++;
                }
            }
            for (int a = 0; a < id.Length; a++)
            {
                th.Add(id[a].sHash, id[a].sPath, 0,
                       ImageCollection.imType.Thumbnail);
            }
            thViewer.DrawControls(id.Length);
            thViewer.FlushDisplay();
            Application.DoEvents();
            th.Load();
            thViewer.DisplayImages(new Point(0, id.Length), id, th);
            tShowThumbs.Start();
        }