创建半透明的模糊背景WPF [英] Creating a semi-transparent blurred background WPF

查看:422
本文介绍了创建半透明的模糊背景WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个边框,我希望此边框的背景部分透明(不透明度0.8),但我不希望其后面的图像定义得很好.我所追求的效果类似于Windows Vista窗口边框效果,您可以在其中看到某些东西,但看不到它是什么.

I have a border, i want the background of this border to be partially transparent (opacity 0.8) but i do not want the image behind it to be well defined. The effect i am after is similar to the Windows Vista window border effect, where you can see that something is behind it but you cant tell what it is.

一些说明:
我正在使用Windows XP,因此无法使用Vista Glass
我需要此解决方案可在任何Windows平台上移植

A few clarifications:
I am working on Windows XP, so i cant use Vista Glass
I need this solution to be portable across any windows platform

任何帮助将不胜感激:)

Any help would be appreciated :)

推荐答案

将玻璃框架扩展到WPF应用程序中

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

概述后的DWM模糊

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

Hope one of those links helps. I used the 1'st link I had to add this class to make it work:

#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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆