In my winforms application I am able to change the taskbar icon using this.Icon
but that also changes the application icon in the titlebar.
this is how I'm currently editing the icon:
public static Icon GetIcon(string text)
{
//Create bitmap, kind of canvas
Bitmap bitmap = new Bitmap(32, 32);
Icon icon = new Icon(@"<icon-location>");
System.Drawing.Font drawFont = new System.Drawing.Font("Calibri", 12, FontStyle.Bold);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Orange);
System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
graphics.DrawIcon(icon, 0, 0);
graphics.DrawString(text, drawFont, drawBrush, 20, 15);
Icon createdIcon = Icon.FromHandle(bitmap.GetHicon());
drawFont.Dispose();
drawBrush.Dispose();
graphics.Dispose();
bitmap.Dispose();
return createdIcon;
}
This wasn't a problem until the requirements changed and now only the taskbar icon needs to be changed without changing the titlebar (top-left application window) icon.
After some search, I came across this answer which basically states that different resolutions are being used to display the icon at different places. "Greenfish Icon Editor Pro" mentioned in that answer works good but my edits needs to be done at runtime as it's being used as a notification method to notify the user of the number of unread notifications so it's not a one time edit.
I realize i need to change the 64x64 of the icon to achieve my goal, but so far all I'm able to do is change the icon all together.
Is there anyway i can edit the GetIcon() function to edit a specific icon resolution? (or at least a suggestion of an alternative method would be much appreciated)