diff --git a/Mk0.Software.ImageSorter/Main.cs b/Mk0.Software.ImageSorter/Main.cs index 3a870dc..e5d4461 100644 --- a/Mk0.Software.ImageSorter/Main.cs +++ b/Mk0.Software.ImageSorter/Main.cs @@ -858,6 +858,7 @@ namespace Mk0.Software.ImageSorter CountPicsInPath(); LoadPicture(imageIndex); CheckUndo(); + ShowPreviewImages(); if (Properties.Settings.Default.fading) { @@ -962,6 +963,7 @@ namespace Mk0.Software.ImageSorter CountPicsInPath(); LoadPicture(imageIndex); CheckUndo(); + ShowPreviewImages(); } /// @@ -1729,6 +1731,7 @@ namespace Mk0.Software.ImageSorter CountPicsInPath(); LoadPicture(0); ResetUndo(); + ShowPreviewImages(); } /// @@ -1992,6 +1995,9 @@ namespace Mk0.Software.ImageSorter } } + /// + /// Bildvorschau erzeugen und laden + /// private void ShowPreviewImages() { panelPreview.Controls.Clear(); @@ -2010,15 +2016,49 @@ namespace Mk0.Software.ImageSorter Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left, BackgroundImage = Resources.no_picture, BackgroundImageLayout = ImageLayout.Stretch, - BorderStyle = BorderStyle.FixedSingle, + BorderStyle = BorderStyle.None, Location = new Point(moveNext, previewImageAbstand), Name = "pictureBoxPreview" + i, Size = new Size(previewImageWidth, previewImageWidth), TabIndex = 0, - TabStop = false + TabStop = false, + SizeMode = PictureBoxSizeMode.Zoom }; panelPreview.Controls.Add(pb); } + + int pIndex = imageIndex; + foreach (PictureBox pb in panelPreview.Controls.OfType()) + { + //preview laden + if (images.Count() > pIndex) + { + pIndex += 1; + if (pIndex >= images.Count() || pIndex < 0) + { + pIndex = 0; + } + pb.ImageLocation = images.ElementAt(pIndex); + pb.BackgroundImage = null; + pb.Tag = pIndex; + pb.Click += new System.EventHandler(this.LoadPictureFromPreview_Click); + } + else + { + pb.BackgroundImage = Resources.no_picture; + } + } + } + + /// + /// Lädt Bilder, die in Vorschau angeklickt wurden + /// + /// + /// + private void LoadPictureFromPreview_Click(object sender, EventArgs e) + { + var pb = (PictureBox)sender; + LoadPicture((int)pb.Tag); } ///