dynamically convert png to ico to reduce file size

This commit is contained in:
Kang Yu 2024-01-19 14:42:27 -08:00
parent dd20274ce3
commit 09f9717b48
7 changed files with 27 additions and 7 deletions

View file

@ -251,7 +251,7 @@ namespace PersistentWindows.SystrayShell
icon_path2 = Path.Combine(appDataFolder, "pwIconBusy.png");
if (File.Exists(icon_path2))
{
var bitmap = new System.Drawing.Bitmap(icon_path2); // or get it from resource
var bitmap = new System.Drawing.Bitmap(icon_path2);
var iconHandle = bitmap.GetHicon();
BusyIcon = System.Drawing.Icon.FromHandle(iconHandle);
}
@ -260,8 +260,9 @@ namespace PersistentWindows.SystrayShell
BusyIcon = new System.Drawing.Icon(icon_path);
}
else
{
BusyIcon = Properties.Resources.pwIconBusy;
{
var iconHandle = Properties.Resources.pwIconBusy.GetHicon();
BusyIcon = System.Drawing.Icon.FromHandle(iconHandle);
}
systrayForm = new SystrayForm();