DWM problem (Vista glass) when setting transparencykey

Posted on 2008-11-12
Last Modified: 2013-12-17
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,

Kind regards,

public partial class Form1 : Form


        MARGINS glassMarges;

        public Form1()



            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;




Open in new window

Question by:guyvaio

    Author Comment

    No answer. Does it mean "no solution" ?
    Is really possible that Microsoft has conceived as "incompatible" the transparency and the blur effect in the .net framework ?
    Kind regrads,

    Accepted Solution

    No solution ! Where are the experts ?

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now