Beispiel #1
0
 private static bool SetGlassMargin(this Window window, Thickness margin)
 {
     if (!NativeMethods.DwmIsCompositionEnabled())
         return false;
     IntPtr handle = new WindowInteropHelper(window).Handle;
     if (handle == IntPtr.Zero)
         throw new InvalidOperationException("The Window must be loaded before extending glass.");
     window.Background = (Brush)Brushes.Transparent;
     HwndSource.FromHwnd(handle).CompositionTarget.BackgroundColor = Colors.Transparent;
     MARGINS margins = new MARGINS(margin);
     NativeMethods.DwmExtendFrameIntoClientArea(handle, ref margins);
     return true;
 }
Beispiel #2
0
 public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);