创建半透明的模糊背景WPF [英] Creating a semi-transparent blurred background 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 :)
推荐答案
希望这些链接之一对您有所帮助.我使用了第一个链接,我必须添加该类才能使其正常工作:
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屋!