Browse Source

Merge pull request #7755 from AvaloniaUI/fixes/win32-can-resize

Fixes/win32 can resize
pull/8753/head
Dan Walmsley 4 years ago
parent
commit
9f50abd761
  1. 14
      src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs
  2. 11
      src/Windows/Avalonia.Win32/WindowImpl.cs

14
src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs

@ -23,16 +23,10 @@ namespace Avalonia.Win32
AdjustWindowRectEx(ref rcFrame, (uint)(WindowStyles.WS_OVERLAPPEDWINDOW & ~WindowStyles.WS_CAPTION), false, 0);
var borderThickness = new RECT();
if (GetStyle().HasAllFlags(WindowStyles.WS_THICKFRAME))
{
AdjustWindowRectEx(ref borderThickness, (uint)(GetStyle()), false, 0);
borderThickness.left *= -1;
borderThickness.top *= -1;
}
else if (GetStyle().HasAllFlags(WindowStyles.WS_BORDER))
{
borderThickness = new RECT { bottom = 1, left = 1, right = 1, top = 1 };
}
AdjustWindowRectEx(ref borderThickness, (uint)GetStyle(), false, 0);
borderThickness.left *= -1;
borderThickness.top *= -1;
if (_extendTitleBarHint >= 0)
{

11
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -648,13 +648,16 @@ namespace Avalonia.Win32
public void BeginResizeDrag(WindowEdge edge, PointerPressedEventArgs e)
{
if (_windowProperties.IsResizable)
{
#if USE_MANAGED_DRAG
_managedDrag.BeginResizeDrag(edge, ScreenToClient(MouseDevice.Position.ToPoint(_scaling)));
_managedDrag.BeginResizeDrag(edge, ScreenToClient(MouseDevice.Position.ToPoint(_scaling)));
#else
_mouseDevice.Capture(null);
DefWindowProc(_hwnd, (int)WindowsMessage.WM_NCLBUTTONDOWN,
new IntPtr((int)s_edgeLookup[edge]), IntPtr.Zero);
_mouseDevice.Capture(null);
DefWindowProc(_hwnd, (int)WindowsMessage.WM_NCLBUTTONDOWN,
new IntPtr((int)s_edgeLookup[edge]), IntPtr.Zero);
#endif
}
}
public void SetTitle(string title)

Loading…
Cancel
Save