优化代码

This commit is contained in:
2026-04-30 14:29:06 +08:00
parent 988af60a30
commit d30ed9e726
35 changed files with 46 additions and 85 deletions
@@ -47,7 +47,7 @@ namespace Ink_Canvas
private void YesOrNoNotificationWindow_Loaded(object sender, RoutedEventArgs e)
{
_hwnd = new WindowInteropHelper(this).Handle;
Topmost = true;
Activate();
Focus();
@@ -71,13 +71,13 @@ namespace Ink_Canvas
if (_hwnd == IntPtr.Zero) return;
var foregroundWindow = GetForegroundWindow();
if (foregroundWindow != _hwnd && IsWindowVisible(_hwnd))
{
Topmost = true;
Activate();
Focus();
SetWindowPos(_hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
}