I have a border, i want the backgr开发者_如何学编程ound 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.
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 platformAny help would be appreciated :)
Extend Glass Frame Into a WPF Application
WPF Window with aero glass background. (C# .NET)
DWM Blur Behind Overview
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
This is the best I could find on the net:
http://blogs.msdn.com/unnir/archive/2006/03/01/541154.aspx
Considering the above is by a Microsoft guy, you'd be hard pressed to find a better way to do it.
It does a simple transparency on the window, so not quite like Aero glass. Aero effect is hardware accelerated and most certainly uses Direct3D in some way.
This SO answer talks about it in some detail:
Is it possible to achieve the "Aero Glass" look on XP?
In Silverlight there is a Blur effect (http://www.silverlightshow.net/tips/Using-Blur-and-DropShadow-effects-in-Silverlight-3.aspx) should also be available for WPF (http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci1377157,00.html) you can apply to controls. Maybe combining this with opacity would help you achive the desired goal?
精彩评论