Please consider the minimum code below. This code creates a simple form with a 100 pixels above margin with vista blur glass effect. (For support purpose, we assume this code will be only executed under Vista)
All works very fine until I set the transparencyKey of this form. If the transparencyKey is set to a non empty value, the blur glass region is painted in black.
My pupose is to "bore a hole" in the form to let see a region of the next application in the z-order.
Thanks in advance for help,
public partial class Form1 : Form
glassMarges = new MARGINS(0, 0, 100, 0);
DwmExtendFrameIntoClientArea(this.Handle, ref glassMarges);
protected override void OnPaint(PaintEventArgs e)
e.Graphics.FillRectangle(Brushes.Black, Rectangle.FromLTRB(0, 0,this.ClientRectangle.Width, glassMarges.cyTopHeight));
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
public struct MARGINS
public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
public MARGINS(int left, int right, int top, int bottom)
cxLeftWidth = left; cyTopHeight = top;
cxRightWidth = right; cyBottomHeight = bottom;