Пример #1
0
        public static bool GlassBackground(this Window window)
        {
            if (Environment.OSVersion.Version.Major >= 6 && AeroGlass.DwmIsCompositionEnabled())
            {
                IntPtr mainWindowPtr = new WindowInteropHelper(window).Handle;
                HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
                mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent;

                window.Background = Brushes.Transparent;

                MARGINS Margins = new MARGINS();
                Margins.cxLeftWidth = 1;
                Margins.cxRightWidth = -1;
                Margins.cyBottomHeight = -1;
                Margins.cyTopHeight = 1;

                int result = AeroGlass.DwmExtendFrameIntoClientArea(mainWindowSrc.Handle, ref Margins);
                return true;
            }
            else return false;
        }
Пример #2
0
 public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMargins);