Search code examples
c#windowswinformsthemesaero

C#: Glass Forms?


How can I use aero glass to cover my entire forms? Here is an example of what I mean:

enter image description here


Solution

  • [StructLayout(LayoutKind.Sequential)]
    public struct MARGINS
    {
        public int Left;
        public int Right;
        public int Top;
        public int Bottom;
    }
    
    [DllImport("dwmapi.dll")]
    public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);
    

    Then you can enable it on your form like so:

    MARGINS marg = new MARGINS() { Left = -1, Right = -1, Top = -1, Bottom = -1 };
    DwmExtendFrameIntoClientArea(form.Handle, ref marg);