mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +13:00
Crop transparent edges from icons then center it
This commit is contained in:
parent
791f9fb693
commit
2c01aea2bc
1 changed files with 24 additions and 20 deletions
|
@ -159,6 +159,8 @@ public void UpdateThumbnail()
|
||||||
{
|
{
|
||||||
string filePath = Task.Info.FilePath;
|
string filePath = Task.Info.FilePath;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Helpers.IsImageFile(filePath))
|
if (Helpers.IsImageFile(filePath))
|
||||||
|
@ -178,9 +180,10 @@ public void UpdateThumbnail()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (Icon icon = NativeMethods.GetJumboFileIcon(filePath))
|
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.Image = ThumbnailImage;
|
||||||
pbThumbnail.Cursor = pThumbnail.Cursor = Cursors.Default;
|
pbThumbnail.Cursor = pThumbnail.Cursor = Cursors.Default;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +195,7 @@ public void UpdateThumbnail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateProgress()
|
public void UpdateProgress()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue