5

我有一个边框,我希望这个边框的背景是部分透明的(不透明度 0.8),但我不希望它后面的图像被很好地定义。我追求的效果类似于Windows Vista的窗口边框效果,你可以看到它后面有东西,但你不能知道它是什么。

一些澄清:
我正在使用 Windows XP,所以我不能使用 Vista Glass
我需要这个解决方案可以在任何 Windows 平台上移植

任何帮助,将不胜感激 :)

4

3 回答 3

2

将 Glass Frame 扩展到 WPF 应用程序

带有航空玻璃背景的 WPF 窗口。(C#.NET)

DWM 模糊背后概述

希望这些链接之一有所帮助。我使用了第一个链接,我必须添加这个类才能使其工作:

#region WINAPI Crap, none should handle this in 21st century
    private class NonClientRegionAPI
    {
        [StructLayout(LayoutKind.Sequential)]
        public struct MARGINS
        {
            public int cxLeftWidth;      // width of left border that retains its size
            public int cxRightWidth;     // width of right border that retains its size
            public int cyTopHeight;      // height of top border that retains its size
            public int cyBottomHeight;   // height of bottom border that retains its size
        };


        [DllImport("DwmApi.dll")]
        public static extern int DwmExtendFrameIntoClientArea(
            IntPtr hwnd,
            ref MARGINS pMarInset);

    }
    #endregion
于 2011-06-25T00:22:00.733 回答
1

这是我在网上能找到的最好的:

http://blogs.msdn.com/unnir/archive/2006/03/01/541154.aspx

考虑到上述内容是由微软的人提出的,你很难找到更好的方法来做到这一点。

它在窗户上做了一个简单的透明度,所以不太像 Aero 玻璃。Aero 效果是硬件加速的,并且肯定会以某种方式使用 Direct3D。

这个 SO answer 详细讨论了它:

是否可以在 XP 上实现“航空玻璃”外观?

于 2010-05-07T05:25:27.360 回答
0

在 Silverlight 中有一个模糊效果 ( http://www.silverlightshow.net/tips/Using-Blur-and-DropShadow-effects-in-Silverlight-3.aspx ) 也应该可用于 WPF ( http://searchwindevelopment .techtarget.com/tip/0,289483,sid8_gci1377157,00.html)您可以应用于控件。也许将其与不透明度结合起来可以帮助您实现预期的目标?

于 2010-05-07T11:44:57.860 回答