delete redundant codes
This commit is contained in:
1 parent
e64362bdcd
commit
c17e86ca55
13 files changed
+191
-538
No files matched your search
@@ -7,6 +7,7 @@ using System.Security;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using HandyControl.Tools.Extension;
|
||||
using HandyControl.Tools.Helper;
|
||||
using HandyControl.Tools.Interop;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
@@ -19,7 +20,7 @@ namespace HandyControl.Tools
|
||||
/// <returns></returns>
|
||||
public static Window GetActiveWindow() => Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive);
|
||||
|
||||
private static readonly BitArray _cacheValid = new BitArray((int) InteropValues.CacheSlot.NumSlots);
|
||||
private static readonly BitArray _cacheValid = new BitArray((int)InteropValues.CacheSlot.NumSlots);
|
||||
|
||||
private static bool _setDpiX = true;
|
||||
|
||||
@@ -90,7 +91,7 @@ namespace HandyControl.Tools
|
||||
try
|
||||
{
|
||||
_dpiX = InteropMethods.GetDeviceCaps(new HandleRef(null, dc), InteropValues.LOGPIXELSX);
|
||||
_cacheValid[(int) InteropValues.CacheSlot.DpiX] = true;
|
||||
_cacheValid[(int)InteropValues.CacheSlot.DpiX] = true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -113,9 +114,9 @@ namespace HandyControl.Tools
|
||||
{
|
||||
lock (_cacheValid)
|
||||
{
|
||||
while (!_cacheValid[(int) InteropValues.CacheSlot.WindowResizeBorderThickness])
|
||||
while (!_cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness])
|
||||
{
|
||||
_cacheValid[(int) InteropValues.CacheSlot.WindowResizeBorderThickness] = true;
|
||||
_cacheValid[(int)InteropValues.CacheSlot.WindowResizeBorderThickness] = true;
|
||||
|
||||
var frameSize = new Size(InteropMethods.GetSystemMetrics(InteropValues.SM.CXSIZEFRAME), InteropMethods.GetSystemMetrics(InteropValues.SM.CYSIZEFRAME));
|
||||
var frameSizeInDips = DpiHelper.DeviceSizeToLogical(frameSize, DpiX / 96.0, Dpi / 96.0);
|
||||
@@ -142,7 +143,7 @@ namespace HandyControl.Tools
|
||||
InteropMethods.ReleaseDC(IntPtr.Zero, hdc);
|
||||
return WindowResizeBorderThickness.Add(new Thickness((autoHide ? - 4 : 4) * scale));
|
||||
#else
|
||||
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? -4 : 4));
|
||||
return WindowResizeBorderThickness.Add(new Thickness(autoHide ? - 4 : 4));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -154,7 +155,7 @@ namespace HandyControl.Tools
|
||||
public static HwndSource GetHwndSource(this Window window) => HwndSource.FromHwnd(window.GetHandle());
|
||||
|
||||
/// <summary>
|
||||
/// 让窗口激活作为前台最上层窗口
|
||||
/// 让窗口激活作为前台最上层窗口
|
||||
/// </summary>
|
||||
/// <param name="window"></param>
|
||||
public static void SetWindowToForeground(Window window)
|
||||
@@ -189,5 +190,10 @@ namespace HandyControl.Tools
|
||||
window.Topmost = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始使用触摸拖动窗口,在触摸抬起后自动结束
|
||||
/// </summary>
|
||||
public static void TouchDragMove(this Window window) => new TouchDragMoveWindowHelper(window).Start();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user