Basically, all you're doing is extending the window's frame (which already has the glass effect) into the client area. You have to call the DWM API that come with Windows Vista or later using a couple of P/invoke methods because this is not built into the .NET Framework.
EDIT: If you're looking for more control over the blur effect, you might look into more specifically the DwmEnableBlurBehindWindow function from the DWM API, although I have not used this myself.
The MARGINS array is similar to margins on an HTML page. The first example on MSDN gives the margins for the glass effect 25 pixels in height on the bottom of the window.
发布评论
评论(3)
如果您正在寻找的是标准玻璃效果(包括模糊),请查看这篇文章:
http://www.codeproject.com/KB/vista/AeroGlassForms.aspx
基本上,您所做的就是将窗口的框架(已经具有玻璃效果)扩展到客户区域。您必须使用几个 P/invoke 方法来调用 Windows Vista 或更高版本附带的 DWM API,因为这不是内置于 .NET Framework 中的。
编辑:如果您正在寻找对模糊效果的更多控制,您可能会更具体地研究 DwmEnableBlurBehindWindow 来自 DWM API 的函数,尽管我自己没有使用过这个。
If all you are looking for is the standard glass effect (which includes the blur), check out this article:
http://www.codeproject.com/KB/vista/AeroGlassForms.aspx
Basically, all you're doing is extending the window's frame (which already has the glass effect) into the client area. You have to call the DWM API that come with Windows Vista or later using a couple of P/invoke methods because this is not built into the .NET Framework.
EDIT: If you're looking for more control over the blur effect, you might look into more specifically the DwmEnableBlurBehindWindow function from the DWM API, although I have not used this myself.
看一下:
http://msdn.microsoft。 com/en-us/library/aa969512(VS.85).aspx
MARGINS 数组类似于 HTML 页面上的边距。 MSDN 上的第一个示例给出了窗口底部高度为 25 像素的玻璃效果的边距。
Take a look at this:
http://msdn.microsoft.com/en-us/library/aa969512(VS.85).aspx
The MARGINS array is similar to margins on an HTML page. The first example on MSDN gives the margins for the glass effect 25 pixels in height on the bottom of the window.
此 MS 教程相当容易理解并使用 C#。
This MS tutorial is fairly easy to understand and uses C#.