C# WPF - 应用程序图标 +在任务栏显示 = False
我创建了一个具有以下属性的自定义分层 WPF 窗口:
- AllowsTransparency = True
- ShowInTaskbar = False
- 背景 = 透明
- 最上面 = True
- Icon = "Icon.ico"
我已在“项目属性”->“应用程序”下添加了 Icon.ico “选项卡。
如果 ShowInTaskBar 为 false,则该图标将显示为默认的 WPF 窗口图标,但如果 ShowInTaskbar 为 true,则该图标将正确显示。
我们希望图标在 Alt+Tab 菜单中正确显示。我们怎样才能实现这一点并让 ShowInTaskbar = False?
I've created a custom layered WPF window with the following properties:
- AllowsTransparency = True
- ShowInTaskbar = False
- Background = Transparent
- Topmost = True
- Icon = "Icon.ico"
I've added Icon.ico under "Project Properties"->"Application" tab.
The icon displays as the default WPF window icon if ShowInTaskBar is false, but displays correctly if ShowInTaskbar is true.
We want the icon to show up correctly in the Alt+Tab menu. How can we achieve this and have ShowInTaskbar = False?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有几个问题。首先,当 ShowInTaskbar 属性设置为 false 时,将创建一个不可见窗口并将其指定为当前窗口的父窗口。在窗口之间切换时会显示该不可见窗口的图标。
您可以使用 Interop 捕获该窗口并设置其图标,如下所示:
您需要考虑的其他问题是:
There are several problems here. First of all, when ShowInTaskbar property is set to false, an invisible window gets created and assigned as a parent of current window. This invisible window's icon is displayed when switching between windows.
You can catch that window with Interop and set it's icon like this:
The other problems for you to think about would be: