From d5cac938c277293d45bce417213cfed66c09fbc0 Mon Sep 17 00:00:00 2001 From: PrefacedCorg <1876568293@qq.com> Date: Sat, 20 Dec 2025 13:03:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=AF=E7=94=A8=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E5=8A=A9=E6=89=8B=E6=97=B6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E5=A4=84=E7=90=86=E7=99=BD=E6=9D=BF=E5=92=8C?= =?UTF-8?q?=E6=89=B9=E6=B3=A8=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 进入白板/批注模式时自动全屏 - 退出时恢复工作区域大小 - 添加状态跟踪避免重复处理 - PPT放映模式和白板模式切换时正确管理全屏状态 --- Ink Canvas/Helpers/PPTUIManager.cs | 4 ++ Ink Canvas/MainWindow.xaml.cs | 3 ++ .../MainWindow_cs/MW_FloatingBarIcons.cs | 41 +++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/Ink Canvas/Helpers/PPTUIManager.cs b/Ink Canvas/Helpers/PPTUIManager.cs index 1c65e9ef..1fd354a5 100644 --- a/Ink Canvas/Helpers/PPTUIManager.cs +++ b/Ink Canvas/Helpers/PPTUIManager.cs @@ -107,6 +107,8 @@ namespace Ink_Canvas.Helpers System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); }), DispatcherPriority.ApplicationIdle); + + _mainWindow.isFullScreenApplied = true; // 标记已应用全屏处理 } } else @@ -127,6 +129,8 @@ namespace Ink_Canvas.Helpers workingArea.X, workingArea.Y, workingArea.Width, workingArea.Height, true); }), DispatcherPriority.ApplicationIdle); + + _mainWindow.isFullScreenApplied = false; // 标记全屏处理已还原 } } } diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 8863f794..8ecc2c31 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -67,6 +67,9 @@ namespace Ink_Canvas // 设置面板相关状态 private bool userChangedNoFocusModeInSettings; private bool isTemporarilyDisablingNoFocusMode = false; + + // 全屏处理状态标志 + public bool isFullScreenApplied = false; diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 87fa368c..2c71db66 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -3075,6 +3075,8 @@ namespace Ink_Canvas workingArea.Left, workingArea.Top, workingArea.Width, workingArea.Height, true); }), DispatcherPriority.ApplicationIdle); + + isFullScreenApplied = false; // 标记全屏处理已还原 } // 在屏幕模式下恢复基础浮动栏的显示 @@ -3144,6 +3146,8 @@ namespace Ink_Canvas System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); }), DispatcherPriority.ApplicationIdle); + + isFullScreenApplied = true; // 标记已应用全屏处理 } ViewboxFloatingBar.Visibility = Visibility.Collapsed; @@ -3201,6 +3205,7 @@ namespace Ink_Canvas { if (GridTransparencyFakeBackground.Background == Brushes.Transparent) { + // 进入批注模式 GridTransparencyFakeBackground.Opacity = 1; GridTransparencyFakeBackground.Background = new SolidColorBrush(StringToColor("#01FFFFFF")); inkCanvas.IsHitTestVisible = true; @@ -3225,6 +3230,21 @@ namespace Ink_Canvas } BtnHideInkCanvas.Content = "隐藏\n画板"; + + // 进入批注模式时的全屏处理(仅当未应用过全屏处理时) + if (Settings.Advanced.IsEnableAvoidFullScreenHelper && !isFullScreenApplied) + { + // 设置为画板模式,允许全屏操作 + AvoidFullScreenHelper.SetBoardMode(true); + Dispatcher.BeginInvoke(new Action(() => + { + MainWindow.MoveWindow(new WindowInteropHelper(this).Handle, 0, 0, + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true); + }), DispatcherPriority.ApplicationIdle); + + isFullScreenApplied = true; // 标记已应用全屏处理 + } } else { @@ -3275,6 +3295,27 @@ namespace Ink_Canvas GridBackgroundCoverHolder.Visibility = Visibility.Collapsed; + // 退出批注模式时的全屏还原(仅当之前应用过全屏处理且不在白板模式时) + if (Settings.Advanced.IsEnableAvoidFullScreenHelper && + isFullScreenApplied && + currentMode == 0 && // 不在白板模式 + BtnPPTSlideShowEnd.Visibility != Visibility.Visible) // 不在PPT放映模式 + { + // 恢复为非画板模式,重新启用全屏限制 + AvoidFullScreenHelper.SetBoardMode(false); + + Dispatcher.BeginInvoke(new Action(() => + { + // 退出批注模式,恢复到工作区域大小 + var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; + MainWindow.MoveWindow(new WindowInteropHelper(this).Handle, + workingArea.Left, workingArea.Top, + workingArea.Width, workingArea.Height, true); + }), DispatcherPriority.ApplicationIdle); + + isFullScreenApplied = false; // 标记全屏处理已还原 + } + if (currentMode != 0) { SaveStrokes();