From 16c3446d3265aaac3bba0697f842e98149dad4cc Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 15 May 2019 02:41:24 +0300 Subject: [PATCH] Use extra large icon for files instead of jumbo icon --- ShareX.HelpersLib/Native/NativeMethods_Helpers.cs | 4 ++-- ShareX/Controls/TaskPanel.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs b/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs index e9a70dd0f..ce06ed355 100644 --- a/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs +++ b/ShareX.HelpersLib/Native/NativeMethods_Helpers.cs @@ -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); diff --git a/ShareX/Controls/TaskPanel.cs b/ShareX/Controls/TaskPanel.cs index d202b7255..23f9e01fc 100644 --- a/ShareX/Controls/TaskPanel.cs +++ b/ShareX/Controls/TaskPanel.cs @@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License 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;