private void ExtendGlass()
        {
            try
            {
                var pointer = new WindowInteropHelper(this).Handle;
                var hwndSource = HwndSource.FromHwnd(pointer);

                Background = Brushes.Transparent;
                hwndSource.CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);

                var margins = new MARGINS
                {
                    cxLeftWidth = -1,
                    cxRightWidth = -1,
                    cyBottomHeight = -1,
                    cyTopHeight = -1
                };

                var result = NativeWindow.DwmExtendFrameIntoClientArea(hwndSource.Handle, ref margins);

                //if(result < 0)
                //Failed extending.
            }
            catch (Exception)
            {
                //Not vista or 7
                Background = Brushes.White;
            }
        }
 public static extern int DwmExtendFrameIntoClientArea(
     IntPtr hwnd,
     ref MARGINS pMarInset);
示例#3
0
 public static extern int DwmExtendFrameIntoClientArea(
     IntPtr hwnd,
     ref MARGINS pMarInset);