【发布时间】:2012-01-11 01:30:04
【问题描述】:
我想知道如何在不打开窗口的情况下打开图像,所以它就像图像漂浮在我的桌面上没有边框一样。谢谢
【问题讨论】:
-
这个Link可以帮助你。你需要使用相同的技术逐像素绘制图片。
我想知道如何在不打开窗口的情况下打开图像,所以它就像图像漂浮在我的桌面上没有边框一样。谢谢
【问题讨论】:
【讨论】:
显示一个没有标题栏的窗口
在winforms的情况下-
FormBorderStyle = None
ControlBox = false
取自 - Windows Form with Resizing Frame and no Title Bar?
在 XAML 的情况下,使用它来显示没有标题栏的窗口 -
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="640" Height="480"
WindowStyle="None"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip">
<!-- Content -->
</Window>
取自 - Is it possible to display a wpf window without an icon in the title bar?
【讨论】:
您要做的是在屏幕上绘制一个没有可见窗口边框的图像。是否会创建一个窗口是一个完全不同的问题。事实证明,你必须有一个窗口。它只是不可见。所以:
创建一个窗口,确保在InitializeComponent()中设置以下内容:
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.ShowIcon = false;
this.ShowInTaskbar = false;
然后,为该窗口覆盖OnPaintBackground,如下所示:
protected override void OnPaintBackground( WinForms.PaintEventArgs e )
{
e.Graphics.DrawImage( Image, 0, 0, Width, Height );
}
【讨论】: