Beispiel #1
0
        private void GetPictures(ShellContainer folder)
        {
            // Just for demo purposes, stop at 20 pics
            if (picturesList.Count >= 20)
            {
                return;
            }

            // First get the pictures in this folder
            foreach (ShellFile sf in folder.OfType <ShellFile>())
            {
                string ext = Path.GetExtension(sf.Path).ToLower();

                if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp")
                {
                    picturesList.Add(sf);
                }
            }

            // Then recurse into each subfolder
            foreach (ShellContainer subFolder in folder.OfType <ShellContainer>())
            {
                GetPictures(subFolder);
            }
        }
Beispiel #2
0
        private void GetPictures(ShellContainer folder)
        {
            // Just for demo purposes, stop at 20 pics
            if (picturesList.Count >= 20)
            {
                return;
            }

            // First get the pictures in this folder
            foreach (ShellFile sf in folder.OfType <ShellFile>())
            {
                string ext = Path.GetExtension(sf.Path).ToLower();

                if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp")
                {
                    ListViewItem item = new ListViewItem();
                    item.Text       = sf.Name;
                    item.ImageIndex = imgListCount;
                    item.Tag        = sf.Path;
                    imgList.Images.Add(Image.FromFile(sf.Path));

                    picturesList.Add(item);
                    imgListCount++;
                }
            }

            // Then recurse into each subfolder
            foreach (ShellContainer subFolder in folder.OfType <ShellContainer>())
            {
                GetPictures(subFolder);
            }
        }
        private void GetPictures(ShellContainer folder)
        {
            // Just for demo purposes, stop at 20 pics
            if (picturesList.Count >= 20)
                return;

            // First get the pictures in this folder
            foreach (ShellFile sf in folder.OfType<ShellFile>())
            {
                string ext = Path.GetExtension(sf.Path).ToLower();

                if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp")
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = sf.Name;
                    item.ImageIndex = imgListCount;
                    item.Tag = sf.Path;
                    imgList.Images.Add(Image.FromFile(sf.Path));

                    picturesList.Add(item);
                    imgListCount++;
                }
            }

            // Then recurse into each subfolder
            foreach (ShellContainer subFolder in folder.OfType<ShellContainer>())
                GetPictures(subFolder);
        }
Beispiel #4
0
        private void GetPictures(ShellContainer folder)
        {
            // Just for demo purposes, stop at 20 pics
            if (picturesList.Count >= 20)
                return;

            // First get the pictures in this folder
            foreach (ShellFile sf in folder.OfType<ShellFile>())
            {
                string ext = Path.GetExtension(sf.Path).ToLower();

                if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp")
                    picturesList.Add(sf);
            }

            // Then recurse into each subfolder
            foreach (ShellContainer subFolder in folder.OfType<ShellContainer>())
                GetPictures(subFolder);
        }