In my this.Icon
application, I can change the taskbar icon using this.Icon
, but also change the application icon in the header.
this is how i edit the icon now:
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 was not a problem until the requirements have changed, and now you only need to change the taskbar icon without changing the title icon (upper left window of the application).
After some searching, I came across this answer , which basically claims that different permissions are used to display the icon in different places. The โGreenfish Icon Editor Proโ mentioned in this answer works well, but my changes must be made at runtime, as it is used as a notification method to notify the user of the number of unread notifications so that it doesn't edit once.
I understand that I need to change the 64x64 icon to achieve my goal, but for now, all I can do is change the icon all together.
Anyway, can I edit the GetIcon () function to edit a specific icon resolution? (or at least suggesting an alternative method would be greatly appreciated)
source share