优化代码

This commit is contained in:
2025-09-30 17:46:35 +08:00
parent 92e695ef7c
commit 92bb458345
16 changed files with 71 additions and 131 deletions
+1 -2
View File
@@ -25,8 +25,7 @@ namespace Ink_Canvas.Helpers
return Screen.PrimaryScreen;
// 获取窗口的句柄
var hwndSource = PresentationSource.FromVisual(window) as HwndSource;
if (hwndSource == null)
if (!(PresentationSource.FromVisual(window) is HwndSource hwndSource))
return Screen.PrimaryScreen;
// 获取窗口在屏幕上的位置