From a6fdb07e8ba1208d03686474e41b4f5e94edbf6e Mon Sep 17 00:00:00 2001 From: PrefacedCorg <1876568293@qq.com> Date: Fri, 3 Apr 2026 00:14:10 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0=20SettingsWindow2.?= =?UTF-8?q?xaml.cs"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ffdb3cd431aaaed9a56ca24bdd82fac4dcd869ad. --- .../Windows/SettingsViews2/SettingsWindow2.xaml.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs index 794de466..f547b119 100644 --- a/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews2/SettingsWindow2.xaml.cs @@ -71,6 +71,12 @@ namespace Ink_Canvas.Windows.SettingsViews2 RegisterDpiChangedListener(); }; + // 窗口拖动到其他屏幕时自动适配 + this.LocationChanged += (sender, e) => + { + SetMaxSizeAndCenter(); + }; + // 窗口关闭时释放资源 this.Closed += (sender, e) => { @@ -188,8 +194,8 @@ namespace Ink_Canvas.Windows.SettingsViews2 double screenTopDip = screenBounds.Top / dpiScaleY; // 4. 设置窗口最大尺寸(保留你原有的边距) - this.MaxWidth = workAreaWidthDip; - this.MaxHeight = workAreaHeightDip; + this.MaxWidth = workAreaWidthDip - 10; + this.MaxHeight = workAreaHeightDip - 40; // 5. 窗口在当前屏幕居中(解决副屏居中跑偏问题) this.Left = screenLeftDip + (workAreaWidthDip - this.ActualWidth) / 2;