I'm trying to have Aero Glass look in my forms in VB.NET 2010 app with DWM API, but as function call suggests, it extends look of Frame to the client area, and if form has no border, nothing will happen and form will become invisible. So, can I get Aero glass in a form without any border.... ??
相关问题
- 'System.Threading.ThreadAbortException' in
- how to use special characters like '<'
- How do I bind a DataGridViewComboBoxColumn to a pr
- Partial Form Class C# - Only display code view for
- Can we add four protocols to ServicePointManager.S
相关文章
- vb.net 关于xps文件操作问题
- Sort TreeView Automatically Upon Adding Nodes
- Where does this quality loss on Images come from?
- Checking for DBNull throws a StrongTypingException
- Using the typical get set properties in C#… with p
- Missing partial modifier on declaration of type
- PropertyGrid - Possible to have a file/directory s
- Why do base Windows Forms form class with generic
As you've said,
DwmExtendFrameIntoClientArea
literally extends the transparent glass effect of the window's frame into its client area, which means that if your form'sFormBorderStyle
is set to "None", your window will effectively be invisible.Instead, you need to use the
DwmEnableBlurBehindWindow
API, which enables the glassy blur effect on a window without requiring it to have a frame/border. It takes two parameters. The first (hWnd
) is the handle to the form that you wish to apply the blur behind effect to. The second (pBlurBehind
) is a structure passed by reference that contains data or parameters for the effect.Therefore, you also have to define the
DWM_BLURBEHIND
structure, which itself contains four members. The first (dwFlags
) is a bitwise combination of constant values that indicate which members of this structure have been set. The second (fEnable
) indicates whether you want to enable or disable the blur effect. The third (hRgnBlur
) allows you to specify a particular region within the client area that the blur effect will be applied to; setting this toNothing
indicates that the entire client area will have the blur effect. The fourth (fTransitionOnMaximized
) allows you to specify whether or not the form's colorization should transition to match the maximized windows.Here are the final API declarations that you have to include in your code in order to use this function:
And then here's a simple example of how you would call this function on a particular form:
If instead, you only want to apply the blur behind effect to a particular subregion of the form, you will need to supply a valid region for the
hRgnBlur
member, and add theDWM_BB_BLURREGION
flag to thedwFlags
member.You can use the
Region.GetHrgn
method to get a handle to the region you want to specify as thehRgnBlur
member. For example, instead of the above code, you can use the following:Notice how, even when specifying a particular subregion to apply the blur-behind effect to, I still set the entire form's background color to black? This will cause the region we specified to render with a glassy blur-behind effect, and the rest of the form to appear transparent. Of course, you can set the rest of the form's background color to any color that you want (although make sure to fill the rectangle that you want to appear as glass with the color black, as before), but it will appear as partially transparent, just without the glassy blur-behind effect. MSDN explains why this is the case:
As far as I'm concerned, that makes applying this effect to only a subregion of the form's window relatively worthless. The only time it seems to me like it might make sense is if you want to render an arbitrary non-rectangular shape as glassy, with the rest of the form remaining transparent.