Codemaid
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.Graphics.Gdi;
|
||||
using System.Runtime.InteropServices;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
namespace Hyperbar.Windows.Win32;
|
||||
@@ -15,7 +15,7 @@ public static class HwndExtensions
|
||||
WS_EX_LAYERED = 0x80000
|
||||
}
|
||||
|
||||
public static void SetWindowOpacity(this IntPtr hWnd,
|
||||
public static void SetWindowOpacity(this IntPtr hWnd,
|
||||
byte value)
|
||||
{
|
||||
HWND hWND = new(hWnd);
|
||||
@@ -72,14 +72,17 @@ public static class HwndExtensions
|
||||
left = 0;
|
||||
top = (info.rcWork.bottom + info.rcWork.top) / 2 - actualHeight / 2;
|
||||
break;
|
||||
|
||||
case WindowPlacement.Top:
|
||||
left = (info.rcWork.left + info.rcWork.right) / 2 - actualWidth / 2;
|
||||
top = 0;
|
||||
break;
|
||||
|
||||
case WindowPlacement.Right:
|
||||
left = info.rcWork.left + info.rcWork.right - actualWidth;
|
||||
top = (info.rcWork.bottom + info.rcWork.top) / 2 - actualHeight / 2;
|
||||
break;
|
||||
|
||||
case WindowPlacement.Bottom:
|
||||
left = (info.rcWork.left + info.rcWork.right) / 2 - actualWidth / 2;
|
||||
top = info.rcWork.bottom + info.rcWork.top - actualHeight;
|
||||
@@ -88,4 +91,4 @@ public static class HwndExtensions
|
||||
|
||||
PInvoke.SetWindowPos(new HWND(hwnd), new HWND(), left, top, actualWidth, actualHeight, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
using Windows.UI.Popups;
|
||||
using WinRT.Interop;
|
||||
|
||||
namespace Hyperbar.Windows.Win32;
|
||||
@@ -34,4 +33,4 @@ public static class WindowExtensions
|
||||
WindowPlacement placement,
|
||||
double? width = null,
|
||||
double? height = null) => window.GetHandle().SnapWindow(placement, width, height);
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ public enum WindowStyle
|
||||
TiledWindow = 0xCF0000,
|
||||
Visible = 0x10000000,
|
||||
VScroll = 0x200000
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user