Browse Source
Merge pull request #7755 from AvaloniaUI/fixes/win32-can-resize
Fixes/win32 can resize
fixes/center-screen-maximized-parent
Dan Walmsley
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
11 additions and
14 deletions
-
src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs
-
src/Windows/Avalonia.Win32/WindowImpl.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) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -633,13 +633,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) |
|
|
|
|