Use extra large icon for files instead of jumbo icon

This commit is contained in:
Jaex 2019-05-15 02:41:24 +03:00
parent 2c01aea2bc
commit 16c3446d32
2 changed files with 5 additions and 5 deletions

View file

@ -528,7 +528,7 @@ public static Icon GetFileIcon(string filePath, bool isSmallIcon)
return icon;
}
public static Icon GetJumboFileIcon(string filePath)
public static Icon GetJumboFileIcon(string filePath, bool jumboSize = true)
{
SHFILEINFO shfi = new SHFILEINFO();
@ -538,7 +538,7 @@ public static Icon GetJumboFileIcon(string filePath)
IImageList spiml = null;
Guid guil = new Guid(NativeConstants.IID_IImageList2);
SHGetImageList(NativeConstants.SHIL_JUMBO, ref guil, ref spiml);
SHGetImageList(jumboSize ? NativeConstants.SHIL_JUMBO : NativeConstants.SHIL_EXTRALARGE, ref guil, ref spiml);
IntPtr hIcon = IntPtr.Zero;
spiml.GetIcon(shfi.iIcon, NativeConstants.ILD_TRANSPARENT | NativeConstants.ILD_IMAGE, ref hIcon);

View file

@ -26,6 +26,7 @@
using ShareX.HelpersLib;
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace ShareX
@ -179,9 +180,8 @@ public void UpdateThumbnail()
}
else
{
using (Icon icon = NativeMethods.GetJumboFileIcon(filePath))
using (Bitmap bmp = icon.ToBitmap())
using (Image img = ImageHelpers.AutoCropTransparent(bmp))
using (Icon icon = NativeMethods.GetJumboFileIcon(filePath, false))
using (Image img = icon.ToBitmap())
{
ThumbnailImage = ImageHelpers.ResizeImage(img, ThumbnailSize, false, true);
pbThumbnail.Image = ThumbnailImage;