enhancement: convert pwIcon.png to .ico resource

This commit is contained in:
Kang Yu 2023-12-22 17:57:10 -08:00
parent 904121fcb7
commit 51ba8bb6a8

View file

@ -227,7 +227,14 @@ namespace PersistentWindows.SystrayShell
AppdataFolder = appDataFolder;
string icon_path = Path.Combine(appDataFolder, "pwIcon.ico");
if (File.Exists(icon_path))
string icon_path2 = Path.Combine(appDataFolder, "pwIcon.png");
if (File.Exists(icon_path2))
{
var bitmap = new System.Drawing.Bitmap(icon_path2); // or get it from resource
var iconHandle = bitmap.GetHicon();
IdleIcon = System.Drawing.Icon.FromHandle(iconHandle);
}
else if (File.Exists(icon_path))
{
IdleIcon = new System.Drawing.Icon(icon_path);
}
@ -237,7 +244,14 @@ namespace PersistentWindows.SystrayShell
}
icon_path = Path.Combine(appDataFolder, "pwIconBusy.ico");
if (File.Exists(icon_path))
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 iconHandle = bitmap.GetHicon();
BusyIcon = System.Drawing.Icon.FromHandle(iconHandle);
}
else if (File.Exists(icon_path))
{
BusyIcon = new System.Drawing.Icon(icon_path);
}