示例#1
0
        private void SetPictureZoomSize()
        {
            ImageObject img = ImageList.GetCurrentImage();

            if (img != null)
            {
                if (MainPictureBox.Image != null)
                {
                    MainPictureBox.Image.Dispose();
                }
                if (img.CanZoom())
                {
                    MainPictureBox.Image = img.GetImage(this.ZoomFactor);
                }
                else
                {
                    MainPictureBox.ImageLocation = img.GetPath();
                    MainPictureBox.Load();
                }
                SetPictureFieldSize();
            }
        }
        public void AddHistoryThumbnail(ImageObject image)
        {
            SelectablePictureBox pictureBox = new SelectablePictureBox(image)
            {
                Width  = this.Width / 10,
                Height = this.Height
            };

            DeselectThumbnails();
            pictureBox.SetSelected(true);
            pictureBox.MouseClick += new MouseEventHandler(HistoryPanel_MouseDown);
            this.Controls.Add(pictureBox);
            Images.Insert(0, pictureBox);

            if (Images.Count > 10)
            {
                SelectablePictureBox thumbnail = Images[Images.Count - 1];
                this.Controls.Remove(thumbnail);
                thumbnail.Dispose();
                Images.RemoveAt(Images.Count - 1);
            }
            ResizeThumbnails();
        }
示例#3
0
        private void IndexImages()
        {
            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();

            this.Images.Clear();
            this.CurrentIndex = this.HistoryIndex = 0;

            HashSet <string> addedPaths = new HashSet <string>();

            foreach (DirectoryObject directory in this.Directories)
            {
                if (directory.IsEnabled())
                {
                    string   path       = directory.GetPath();
                    string[] pathsArray = Directory.GetFiles(path, "*", directory.GetSearchOption());

                    foreach (string p in pathsArray)
                    {
                        if (!addedPaths.Contains(p))
                        {
                            ImageObject temp = new ImageObject(p);
                            if (temp.ValidImage())
                            {
                                addedPaths.Add(p);
                                this.Images.Add(temp);
                            }
                        }
                    }
                }
            }

            Cursor.Current = Cursors.Default;

            ContentChanged();
        }