mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Clicking on thumbnail will open fullscreen preview
This commit is contained in:
parent
0546e1b80d
commit
0d6ffbce79
2 changed files with 26 additions and 6 deletions
1
ShareX/Controls/TaskPanel.Designer.cs
generated
1
ShareX/Controls/TaskPanel.Designer.cs
generated
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue