如何使用 C# 和 C# 编写 Windows 7 桌面小工具世界和平基金会?
我想编写一个桌面小工具,将桌面上的图标分组(使用 c# 和 WPF)。 这将是一个停靠窗口,我可以将图标拖到其中,它们将保持不变。也可以有几个这样的窗口。
我从哪里开始呢?
**我在这里看到了所有关于它的帖子,但我迷路了。请引导我查看示例和解释页面。
I want to write a desktop gadget that will group icons on my desktop (using c# & WPF).
It will be a docked window that I can drag icons to it and they will stay their. Also there can be couple of this windows.
Where do I begin?
**I saw all the post here about it but I got lost. Please direct me to examples and explanation pages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
扩展 cevik 的答案:
您无法将 WPF 应用程序创建为小工具但是,您有两个选择(没有您想象的那么糟糕)。
原因是小部件主要由网页 (HTML) 组成,而不是可执行文件 (*.exe)。
当然,问题是 WPF 只能与 & 一起使用。产生可执行文件。
第一个选项 - Windows API:
当我说你不能时,我真正的意思是你不能使用 Windows Vista/7 小工具平台来制作你的小部件。
但是,您始终可以通过使用 Windows API 实现类似的效果。
Windows API 可以让你对窗口做一些事情,比如让它们总是在其他程序的后台运行,这对我来说听起来大约是 80%(剩下的就是确保你的窗口不会重新调整大小或最小化等)。
请注意,您要寻找的使窗口位于所有其他窗口后面的函数将是
SetWindowPos
(具体是第二个参数)。然而,请确保没有一个库已经实现了这些东西,因为它可能相当困难(并且包含很多惊喜)。
第二个选项 - Silverlight
silverlight 可以被视为 Web 的 WPF。< br>
这显然解决了我们的问题。
然而,正如预期的那样,这是有代价的。
Silverlight 不具备 WPF 的所有功能(可能也不具备 .NET 框架的所有功能,对此不确定,因为我并没有真正使用它)。
然而,它应该足以让你度过难关,所以你一定要检查一下。
拥有 Silverlight 应用程序(和网页)后,您必须创建清单和清单。将小工具安装到您的桌面上。请参阅此处如何执行此操作。
To expand on cevik's answer:
You cannot create WPF applications as gadgets BUT you have two options (which aren't as bad as you'd expect).
The reason is that widgets are composed mainly of web pages (HTML) and not executable (*.exe).
The problem of course is that WPF will only work with & produce executables.
First option - Windows API:
When I said you can't what I really meant is you can't use the Windows Vista/7 gadget platform to make your widgets.
However, you can always achieve a similar effect by using the Windows API.
The Windows API will let you do stuff to windows such as making them always on the background of other programs, which sounds to me like ~80% there (The rest would be stuff like making sure your window doesn't get re-sized or minimized, etc.).
Just as a note, the function you'd be looking for to make the window behind all other windows would be
SetWindowPos
(specifically the second parameter).However make sure there isn't a library which already implements these stuff because it can be rather difficult (and consist of A LOT of surprises).
Second option - Silverlight
silverlight can be perceived as WPF for the web.
That obviously solves our problem.
However there is a cost to it, as expected.
Silverlight doesn't have all the features WPF has (possibly not all of the .NET framework as-well, not sure about that as I'm not really using it).
However it should be more than enough to get you by so you should definitely check it out.
Once you have your Silverlight application (and webpage) you'll have to create a manifest & install the gadget to your desktop. See here how to do so.
也许这个会对您有所帮助。
Maybe this will help you.