This commit is contained in:
NaBian committed 2020-05-12 23:59:46 +08:00
1 parent 1fa4c20a91
commit f4a0c6fd4f
7 files changed
+112 -30

No files matched your search

@@ -132,15 +132,17 @@ namespace HandyControl.Tools
{
get
{
InteropValues.APPBARDATA appBarData = default;
var autoHide = InteropMethods.SHAppBarMessage(4, ref appBarData) != 0;
#if netle40
return WindowResizeBorderThickness;
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -8 : 0));
#elif Core
var hdc = InteropMethods.GetDC(IntPtr.Zero);
var scale = InteropMethods.GetDeviceCaps(hdc, InteropValues.DESKTOPVERTRES) / (float)InteropMethods.GetDeviceCaps(hdc, InteropValues.VERTRES);
InteropMethods.ReleaseDC(IntPtr.Zero, hdc);
return WindowResizeBorderThickness.Add(new Thickness(4 * scale));
return WindowResizeBorderThickness.Add(new Thickness((autoHide ? - 4 : 4) * scale));
#else
return WindowResizeBorderThickness.Add(new Thickness(4));
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? - 4 : 4));
#endif
}
}
@@ -17,7 +17,7 @@ namespace HandyControl.Tools.Interop
{
#region common
public const int E_FAIL = unchecked((int)0x80004005);
internal const int E_FAIL = unchecked((int)0x80004005);
internal static readonly IntPtr HRGN_NONE = new IntPtr(-1);
@@ -461,7 +461,10 @@ namespace HandyControl.Tools.Interop
[ReflectionPermission(SecurityAction.Assert, Unrestricted = true),
SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
public static void PtrToStructure(IntPtr lparam, object data) => Marshal.PtrToStructure(lparam, data);
internal static void PtrToStructure(IntPtr lparam, object data) => Marshal.PtrToStructure(lparam, data);
[DllImport(InteropValues.ExternDll.Shell32, CallingConvention = CallingConvention.StdCall)]
internal static extern uint SHAppBarMessage(int dwMessage, ref InteropValues.APPBARDATA pData);
#endregion
@@ -48,6 +48,7 @@ namespace HandyControl.Tools.Interop
NIIF_ERROR = 0x00000003,
WM_ACTIVATE = 0x0006,
WM_QUIT = 0x0012,
WM_GETMINMAXINFO = 0x0024,
WM_WINDOWPOSCHANGING = 0x0046,
WM_WINDOWPOSCHANGED = 0x0047,
WM_SETICON = 0x0080,
@@ -85,7 +86,8 @@ namespace HandyControl.Tools.Interop
SC_MINIMIZE = 0xF020,
SC_MAXIMIZE = 0xF030,
SC_RESTORE = 0xF120,
SRCCOPY = 0x00CC0020;
SRCCOPY = 0x00CC0020,
MONITOR_DEFAULTTONEAREST = 0x00000002;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal class NOTIFYICONDATA
@@ -933,5 +935,26 @@ namespace HandyControl.Tools.Interop
return length;
}
}
[StructLayout(LayoutKind.Sequential)]
internal class MINMAXINFO
{
public POINT ptReserved;
public POINT ptMaxSize;
public POINT ptMaxPosition;
public POINT ptMinTrackSize;
public POINT ptMaxTrackSize;
}
[StructLayout(LayoutKind.Sequential)]
internal struct APPBARDATA
{
public int cbSize;
public IntPtr hWnd;
public uint uCallbackMessage;
public uint uEdge;
public RECT rc;
public int lParam;
}
}
}