wpf - 创建半透明模糊背景 WPF

标签 wpf xaml blur

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

几点说明:
我在 Windows XP 上工作,所以我不能使用 Vista Glass
我需要这个解决方案可以在任何 Windows 平台上移植

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

最佳答案

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

关于wpf - 创建半透明模糊背景 WPF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2786336/

相关文章:

c# - 在一个 WPF ComboBox 中使用三种不同的 ComboBoxItem 样式

c# - 如何使用 bool 值作为触发器

c# - 在 xamarin 表单中选择 ListView 项时如何打开另一个页面?

html - 当鼠标悬停在 img 上时,所有其他图像都使用 CSS 模糊 :not(:hover)

c# - 偏移列标题会留下背景显示的空间

c# - 使用具有不同嵌套类型的 HierarchicalDataTemplate

C# + WPF : how should I do proper checks/guards/casts when accessing control values?

wpf - 防止 WPF 控件扩展到可视区域之外

javascript - jQuery 模糊 div 不在焦点

相机中使用的Android模糊surfaceview