代码之家  ›  专栏  ›  技术社区  ›  TerrorAustralis

创建半透明模糊背景WPF

  •  4
  • TerrorAustralis  · 技术社区  · 15 年前

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



    3 回复  |  直到 15 年前
        1
  •  2
  •   Charles Caldwell    10 年前

    Extend Glass Frame Into a WPF Application

    WPF Window with aero glass background. (C# .NET)

    DWM Blur Behind Overview

    希望其中的一个链接有帮助。我使用了添加这个类的第一个链接:

    #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
    
        2
  •  1
  •   Community CDub    8 年前

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

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

    它在窗户上有一个简单的透明效果,所以不像航空玻璃。Aero effect是硬件加速的,在某种程度上肯定使用了Direct3D。

    Is it possible to achieve the "Aero Glass" look on XP?