我想编写一个 C# 应用程序,它像覆盖在桌面墙纸上一样运行。类似于桌面小部件或 Rainmeter(rainmeter.net) 的运行方式;在其他应用程序之后,但在桌面墙纸之上。
我找不到任何此类行为的 C# 示例。有人可以指点我一些代码吗?
这是我感兴趣的创建示例:http://jabz.us/uploaded_images/screenCaptureRainmeter.png
最佳答案
为什么不只使用 borderless 的 WPF 窗口呢? (因此是静态的,但您可以使用 this code 再次移动它们),transparent和 below all other windows ?您可能必须每 100 毫秒左右轮询一次其余窗口下的每个窗口,以防用户意外单击它。我只用了一些标签做了一点测试,看起来不错。
例如,使用此代码并每隔一段时间轮询“在所有其他窗口下方”方法。
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="LearnWPF.BorderlessWindow" Height="200" Width="200"
WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True"
Background="Transparent"
>
<Border Padding="5" BorderBrush="#feca00"
BorderThickness="3" Width="150" Height="150">
<TextBlock>Learn WPF!</TextBlock>
</Border>
</Window>
关于c# - 壁纸应用程序的代码示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2671198/