How do I ask Windows for the size of system tray icons?

前端 未结 3 1403
陌清茗
陌清茗 2021-01-02 10:26

I noticed that my app sends icons to the Windows tray with a size of 16x16 pixels--and my Vista PC I\'ve got a doublewide taskbar that appears to show icons at 18x18. The re

3条回答
  •  难免孤独
    2021-01-02 10:53

    Your best bet may be GetThemeBackgroundContentRect passing TBN_BACKGROUND as iPartId for the tray notify background.

    GetThemeBackgroundContentRect should return the size defined by the current theme that may be used for drawing without overlapping the borders of the parent element. If I'm reading this correctly, that would be the largest sized notification icon permissible and presumably the size that is being used.

    Testing with multiple DPI settings is probably the easiest way to tell if this is returning the correct value.

提交回复
热议问题