Exemplo n.º 1
0
 internal static void ExtendFrameIntoClientArea(IntPtr hwnd, ref WinApi.Margins margins)
 {
     if (isSupported)
     {
         WinApi.DwmExtendFrameIntoClientArea(hwnd, ref margins);
     }
 }
Exemplo n.º 2
0
        private void SetGlass()
        {
            IsCompositionEnabled = DesktopWindowManager.IsCompositionEnabled;
            if (ParentWindow != null)
            {
                if (IsCompositionEnabled)
                {
                    orinalWindowBackground  = ParentWindow.Background;
                    ParentWindow.Background = Brushes.Transparent;
                    HwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
                    Matrix dpiMatrix = HwndSource.CompositionTarget.TransformToDevice;
                    double dpiY      = dpiMatrix.M22;

                    // Create a margin structure
                    var margins = new WinApi.Margins
                    {
                        Left   = 0,
                        Right  = 0,
                        Top    = (int)Math.Round(this.ActualHeight * dpiY, MidpointRounding.AwayFromZero),
                        Bottom = 0
                    };

                    DesktopWindowManager.ExtendFrameIntoClientArea(HwndSource.Handle, ref margins);
                }

                DesktopWindowManager.SetTitleAndIconVisibility(HwndSource.Handle, false);
            }
        }
Exemplo n.º 3
0
 internal static void ResetGlass(IntPtr hwnd)
 {
     if (isSupported)
     {
         var margins = new WinApi.Margins(false);
         WinApi.DwmExtendFrameIntoClientArea(hwnd, ref margins);
     }
 }
Exemplo n.º 4
0
 internal static void ResetGlass(IntPtr hwnd)
 {
     if (isSupported)
     {
         var margins = new WinApi.Margins(false);
         WinApi.DwmExtendFrameIntoClientArea(hwnd, ref margins);
     }
 }
Exemplo n.º 5
0
        private void SetGlass()
        {
            IsCompositionEnabled = DesktopWindowManager.IsCompositionEnabled;
            if (ParentWindow != null)
            {
                if (IsCompositionEnabled)
                {
                    orinalWindowBackground = ParentWindow.Background;
                    ParentWindow.Background = Brushes.Transparent;
                    HwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
                    Matrix dpiMatrix = HwndSource.CompositionTarget.TransformToDevice;
                    double dpiY = dpiMatrix.M22;

                    // Create a margin structure
                    var margins = new WinApi.Margins
                                      {
                                          Left = 0,
                                          Right = 0,
                                          Top = (int)Math.Round(this.ActualHeight * dpiY, MidpointRounding.AwayFromZero),
                                          Bottom = 0
                                      };

                    DesktopWindowManager.ExtendFrameIntoClientArea(HwndSource.Handle, ref margins);
                }

                DesktopWindowManager.SetTitleAndIconVisibility(HwndSource.Handle, false);
            }
        }