private void PopulateImageList(List<string> deletedFiles)
        {
            Cursor.Current = Cursors.WaitCursor;

            lbImages.Items.Clear();
            List<string> fileNames = new List<string>();

            foreach (string ext in new String[] { "jpg", "jpeg", "gif", "png", "tif", "tiff", "bmp" })
            {
                foreach (string f in Directory.GetFiles(CurrentDirectory, String.Format("*.{0}", ext), System.IO.SearchOption.TopDirectoryOnly))
                {
                    fileNames.Add(f);
                }
            }

            fileNames.Sort();
            int idx = 0;
            int foundAt = -1;

            foreach (string f in fileNames)
            {
                ImageFile img = new ImageFile(f);
                img.Deleted = deletedFiles.Contains(Path.GetFileName(f));
                lbImages.Items.Add(img);
                if (img.FileName == LastFile)
                {
                    foundAt = idx;
                }
                ++idx;
            }

            lblFiles.Text = String.Format("{0} Files", lbImages.Items.Count);
            UpdateMarkedCountLabel();

            Cursor.Current = Cursors.Default;

            lbImages.SelectedIndex = foundAt;
        }
        private void LoadImage(ImageFile f)
        {
            Image img = null;
            if (f != null) {
                Cursor.Current = Cursors.WaitCursor;
                img = f.FileImage.Clone() as Image;
                Cursor.Current = Cursors.Default;

                pictureBox1.Image = img;
                pbDeleteMark.Visible = f.Deleted;

                RecalculateLayout();
            }
            pictureBox1.Image = img;
        }