简体   繁体   English

如何在TaskBar图标上方显示WPF窗口?

[英]How to show a WPF window above a TaskBar icon?

In Google's Chrome App Launcher for Windows, does anyone know how they managed to show the window such that it's centered above the application's icon in the TaskBar? 在Google的适用于Windows的Chrome应用启动器中,是否有人知道他们如何设法显示窗口,使其位于TaskBar中应用程序图标的上方? Any kind of solution for C#/.NET would be fine (p/invoke, etc.). C#/ .NET的任何解决方案都可以(p / invoke等)。

I've searched high and low and there are solutions for the System Tray based on identifying the screen rect of a notify icon, but I have not found one for the TaskBar (except one approach that is based on a screen capture, but it's too fragile for production applications). 我已经搜索了高低,系统托盘的解决方案基于识别通知图标的屏幕矩形,但我还没有找到一个用于TaskBar(除了一种基于屏幕截图的方法,但它也是脆弱的生产应用程序)。

Thanks! 谢谢!

-Tom B. -Tom B.

屏幕截图

Thanks to NETscape's hint, I found that the way that the Chrome App Launcher makes it look like the window is appearing over the TaskBar icon is by checking the mouse position immediately after starting up, and if the mouse is in the TaskBar area then it shows the window directly above the TaskBar and horizontally centered over the mouse. 感谢NETscape的提示,我发现Chrome应用启动器让它看起来就像窗口出现在TaskBar图标上的方式是通过在启动后立即检查鼠标位置,如果鼠标位于TaskBar区域,那么它显示直接位于TaskBar上方的窗口,并在鼠标上方水平居中。

You can test this by moving the mouse left or right immediately after clicking the icon, in which cases the window appears to the left or right of the TaskBar icon. 您可以在单击图标后立即向左或向右移动鼠标进行测试,在这种情况下,窗口将显示在TaskBar图标的左侧或右侧。 If you move the mouse outside the TaskBar area right after clicking it (or launch the app from a Desktop icon) then the window is just anchored to the lower-left corner of the screen. 如果您在单击它之后立即将鼠标移动到TaskBar区域之外(或从桌面图标启动应用程序),则该窗口仅锚定在屏幕的左下角。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM