An implementation of Visual Basic that is built into Microsoft products.
Thank you for reaching out.
This behavior is not caused by WinForms code or by using Me.Icon. What you are seeing is due to how Windows 11 handles taskbar icons when the taskbar overflows.
In a WinForms application, there are two different icons involved:
- The form icon, which you set using
Form.IconorMe.Icon - The application (EXE) icon, which is embedded into the executable using Visual Studio project settings
When the taskbar has enough space, Windows usually shows the form icon. However, when the taskbar becomes crowded and the overflow appears, Windows may rearrange taskbar buttons and internally fall back to using the application (EXE) icon instead. This decision is made by the Windows shell and happens dynamically, without restarting the application or changing any code.
This is why the icon:
- Changes only when the app is positioned near the overflow button
- Automatically returns to the form icon when the overflow disappears
- Cannot be forced or overridden using WinForms APIs or
SendMessage
Because taskbar overflow behavior is controlled by Windows and not documented in detail, there is no supported way to guarantee that the runtime form icon will always be used in every taskbar layout. The recommended and supported approach is to make sure the application icon (EXE icon) is set correctly, so that even if Windows falls back to it, the icon remains consistent.
You can set the application icon using the standard Visual Studio project settings as described here: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-an-application-icon-visual-basic-csharp
Please let us know if you require any further assistance, we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer". So that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.