Provides a single side of the resize/glow border window.
Inheritance: System.Windows.Window
Esempio n. 1
0
 public BorderBrushConverter(BorderWindow border)
 {
     _border = border;
 }
Esempio n. 2
0
 public BorderBrushConverter(BorderWindow border)
 {
     _border = border;
 }
Esempio n. 3
0
        void InitBorders()
        {
            _left = new BorderWindow(this) { Side = BorderSide.Left };
            _top = new BorderWindow(this) { Side = BorderSide.Top };
            _right = new BorderWindow(this) { Side = BorderSide.Right };
            _bottom = new BorderWindow(this) { Side = BorderSide.Bottom };

            SetRegion(hWndContent, 0, 0, true);

            var hSrc = HwndSource.FromHwnd(hWndContent);
            hSrc.AddHook(WndProc);

            //Calculate the effective DPI used by WPF;
            _wpfDPI = 96.0 * hSrc.CompositionTarget.TransformToDevice.M11;
            //Get the Current DPI of the monitor of the window.
            _monitorDPI = Shcore.GetDpiForWindow(hSrc.Handle);
            //Calculate the scale factor used to modify window size, graphics and text
            _dpiScaleFactor = _monitorDPI / _wpfDPI;
            ContentWindow.Width *= _dpiScaleFactor;
            ContentWindow.Height *= _dpiScaleFactor;
            RescaleForDpi();

            // SWP_DRAWFRAME makes window bg really transparent (visible during resize) and not black
            User32.SetWindowPos(hWndContent, IntPtr.Zero, 0, 0, 0, 0,
                SetWindowPosOptions.SWP_NOOWNERZORDER |
                SetWindowPosOptions.SWP_DRAWFRAME |
                SetWindowPosOptions.SWP_NOACTIVATE |
                SetWindowPosOptions.SWP_NOZORDER |
                SetWindowPosOptions.SWP_NOMOVE |
                SetWindowPosOptions.SWP_NOSIZE);
        }