在Windows 7中将WPF窗口固定在桌面上 [英] Pin WPF window on the desktop in Windows 7

查看:373
本文介绍了在Windows 7中将WPF窗口固定在桌面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将WPF窗口固定在桌面上(它应该是桌面小工具).

I want to pin a WPF window on the desktop (it should be a desktop gadget).

我知道您可以通过将WPF窗口的父句柄设置为"progman"窗口的句柄来做到这一点.

I know you can do this by setting the parent handle of the WPF window to the handle of the "progman" window.

但是,这并不能防止在按下"Windows + D"时隐藏WPF窗口.

But this does not prevent the hiding of the WPF window when "Windows + D" is pressed.

必须有另一种方法可以做到这一点.按下"Windows + D"后,Windows 7中的新桌面小工具不会隐藏. MS开发人员是如何实现这一目标的?

There must be another way do to this. The new desktop gadgets in Windows 7 are not hidden when "Windows + D" is pressed. How did the MS developers achieve this?

推荐答案

我认为最好的选择是创建一个小工具并使用以下任一选项托管WPF

I think your best bet would be to create a Gadget and host your WPF using either of the following options

1-使用IFrame托管的WPF.

1- WPF hosted using an IFrame.
WPF Vista Gadgets - Part 1: Using XBAP and IFRAME

2-使用ActiveX托管在小工具中的WPF
http://blogs.msdn.com/karstenj/archive/2006/10/09/activex-wpf-gadget.aspx

2- WPF hosted in the Gadget using ActiveX
http://blogs.msdn.com/karstenj/archive/2006/10/09/activex-wpf-gadget.aspx
http://blogs.msdn.com/jaimer/archive/2006/10/02/writing-a-.net-activex-control-for-your-sidebar-gadget_2E002E00_.aspx

链接的文章适用于Vista,但是概念应相同,因为Windows 7小工具与Vista小工具向后兼容.

The linked articles are for Vista but the concepts should be the same since Windows 7 gadgets are backwards compatible with Vista gadgets.

这篇关于在Windows 7中将WPF窗口固定在桌面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆