void UpdatePosn() { // use GetWindowRect to work correctly with aero snap // since GetWindowPlacement doesn't change var rcNative = default(RECT); if (User32.GetWindowRect(hWndContent, ref rcNative)) { if (false) { // eventually should use this if I can get it working _left.UpdatePosnWin32(rcNative.left - _left.PadSize, rcNative.top - _left.PadSize, _left.PadSize, rcNative.Height + 2 * _left.PadSize); _top.UpdatePosnWin32(rcNative.left - _top.PadSize, rcNative.top - _top.PadSize, rcNative.Width + 2 * _top.PadSize, _top.PadSize); _right.UpdatePosnWin32(rcNative.right, rcNative.top - _right.PadSize, _right.PadSize, rcNative.Height + 2 * _right.PadSize); _bottom.UpdatePosnWin32(rcNative.left - _bottom.PadSize, rcNative.bottom, rcNative.Width + 2 * _bottom.PadSize, _bottom.PadSize); } else { Rect rcWpf = TranslateToWpf(ref rcNative); _left.UpdatePosnWpf(rcWpf.Left - _left.PadSize, rcWpf.Top - _left.PadSize, _left.PadSize, rcWpf.Height + 2 * _left.PadSize); _top.UpdatePosnWpf(rcWpf.Left - _top.PadSize, rcWpf.Top - _top.PadSize, rcWpf.Width + 2 * _top.PadSize, _top.PadSize); _right.UpdatePosnWpf(rcWpf.Right, rcWpf.Top - _right.PadSize, _right.PadSize, rcWpf.Height + 2 * _right.PadSize); _bottom.UpdatePosnWpf(rcWpf.Left - _bottom.PadSize, rcWpf.Bottom, rcWpf.Width + 2 * _bottom.PadSize, _bottom.PadSize); } if (SystemParameters.MinimizeAnimation) { _showTimer.Start(); } else { ShowBorders(); } } }
void UpdatePosn() { // use GetWindowRect to work correctly with aero snap // since GetWindowPlacement doesn't change var rcNative = default(RECT); if (User32.GetWindowRect(hWndContent, ref rcNative)) { Rect rcWpf = TranslateToWpf(ref rcNative); //var scale = UIHooks.GetWindowDpiScale(ContentWindow); var leftW = _left.PadSize; var topH = _top.PadSize; var rightW = _right.PadSize; var botH = _bottom.PadSize; _left.UpdatePosnWpf( rcWpf.Left - leftW, rcWpf.Top - topH, leftW, rcWpf.Height + topH + botH); _top.UpdatePosnWpf( rcWpf.Left - leftW, rcWpf.Top - topH, rcWpf.Width + leftW + rightW, topH); _right.UpdatePosnWpf( rcWpf.Right, rcWpf.Top - topH, rightW, rcWpf.Height + topH + botH); _bottom.UpdatePosnWpf( rcWpf.Left - leftW, rcWpf.Bottom, rcWpf.Width + leftW + rightW, botH); //Rect rcWpf = rcNative; //IntPtr blah = User32.BeginDeferWindowPos(4); //blah = _left.UpdatePosnExp(blah, rcWpf.Left - _left.PadSize, rcWpf.Top - _left.PadSize, _left.PadSize, rcWpf.Height + 2 * _left.PadSize); //blah = _top.UpdatePosnExp(blah, rcWpf.Left - _top.PadSize, rcWpf.Top - _top.PadSize, rcWpf.Width + 2 * _top.PadSize, _top.PadSize); //blah = _right.UpdatePosnExp(blah, rcWpf.Right, rcWpf.Top - _right.PadSize, _right.PadSize, rcWpf.Height + 2 * _right.PadSize); //blah = _bottom.UpdatePosnExp(blah, rcWpf.Left - _bottom.PadSize, rcWpf.Bottom, rcWpf.Width + 2 * _bottom.PadSize, _bottom.PadSize); //User32.EndDeferWindowPos(blah); if (SystemParameters.MinimizeAnimation) { _showTimer.Start(); } else { ShowBorders(); } } }