winformstaskbarnotifyicon

WinForms: Taskbar icon via NotifyIcon component doesn't show up


I found this link from Microsoft on how to implement a Windows taskbar icon for a form which is different from the form's icon. I have one icon that fits to window and another one that fits the taskbar. It worked perfectly the first time I tried but then I had to stop trying it out and go back in code. Now as I am trying to implement it again, it does not work anymore, I have to idea why. Basically it's very easy:

  1. Add a NotifyIcon component to the form
  2. Choose the icon and set visibility

Did anyone experience the same trouble?


Solution

  • The Form's icon in the task bar will be the 48x48 image inside the icon file. An icon file can contain multiple images with different sizes, e.g. 16x16, 24x24, 32x32, 48x48, 64x64, 96x96, 128x128, 256x256. Or more precisely, Windows will pick the closest dimension to what it wants and then scale it to fit.