diff --git a/ShareX/Controls/TaskPanel.Designer.cs b/ShareX/Controls/TaskPanel.Designer.cs index 8f5952ca1..2d7e6e3ad 100644 --- a/ShareX/Controls/TaskPanel.Designer.cs +++ b/ShareX/Controls/TaskPanel.Designer.cs @@ -90,6 +90,7 @@ private void InitializeComponent() this.pbThumbnail.Size = new System.Drawing.Size(246, 246); this.pbThumbnail.TabIndex = 2; this.pbThumbnail.TabStop = false; + this.pbThumbnail.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseDown); // // TaskPanel // diff --git a/ShareX/Controls/TaskPanel.cs b/ShareX/Controls/TaskPanel.cs index 655378594..6295d29da 100644 --- a/ShareX/Controls/TaskPanel.cs +++ b/ShareX/Controls/TaskPanel.cs @@ -169,16 +169,23 @@ public void UpdateThumbnail() { string filePath = Task.Info.FilePath; - using (Image img = ImageHelpers.LoadImage(filePath)) + try { - if (img != null) + using (Image img = ImageHelpers.LoadImage(filePath)) { - ThumbnailSourceFilePath = filePath; - - ThumbnailImage = ImageHelpers.CreateThumbnail(img, ThumbnailSize.Width, ThumbnailSize.Height); - pbThumbnail.Image = ThumbnailImage; + if (img != null) + { + ThumbnailImage = ImageHelpers.CreateThumbnail(img, ThumbnailSize.Width, ThumbnailSize.Height); + pbThumbnail.Image = ThumbnailImage; + ThumbnailSourceFilePath = filePath; + pbThumbnail.Cursor = Cursors.Hand; + } } } + catch (Exception e) + { + DebugHelper.WriteException(e); + } } } @@ -191,11 +198,23 @@ public void ClearThumbnail() ThumbnailImage.Dispose(); ThumbnailImage = null; } + + ThumbnailSourceFilePath = null; } public void UpdateProgress() { Progress = (int)Task.Info.Progress.Percentage; } + + private void PbThumbnail_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left && !string.IsNullOrEmpty(ThumbnailSourceFilePath)) + { + pbThumbnail.Enabled = false; + ImageViewer.ShowImage(ThumbnailSourceFilePath); + pbThumbnail.Enabled = true; + } + } } } \ No newline at end of file