mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
Crop transparent edges from icons then center it
This commit is contained in:
parent
791f9fb693
commit
2c01aea2bc
|
@ -159,6 +159,8 @@ public void UpdateThumbnail()
|
|||
{
|
||||
string filePath = Task.Info.FilePath;
|
||||
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Helpers.IsImageFile(filePath))
|
||||
|
@ -178,9 +180,10 @@ public void UpdateThumbnail()
|
|||
else
|
||||
{
|
||||
using (Icon icon = NativeMethods.GetJumboFileIcon(filePath))
|
||||
using (Image img = icon.ToBitmap())
|
||||
using (Bitmap bmp = icon.ToBitmap())
|
||||
using (Image img = ImageHelpers.AutoCropTransparent(bmp))
|
||||
{
|
||||
ThumbnailImage = ImageHelpers.ResizeImage(img, ThumbnailSize, false);
|
||||
ThumbnailImage = ImageHelpers.ResizeImage(img, ThumbnailSize, false, true);
|
||||
pbThumbnail.Image = ThumbnailImage;
|
||||
pbThumbnail.Cursor = pThumbnail.Cursor = Cursors.Default;
|
||||
}
|
||||
|
@ -192,6 +195,7 @@ public void UpdateThumbnail()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateProgress()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue