From e81198165b46c54e806070587c6c8c8e4f4b39f7 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 4 Oct 2025 17:14:14 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml.cs | 8 ++++---- Ink Canvas/MainWindow_cs/MW_AutoTheme.cs | 15 ++++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index f5626d32..02e19d44 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -2855,24 +2855,24 @@ namespace Ink_Canvas switch (themeIndex) { case 0: // 浅色主题 - SetTheme("Light"); + SetTheme("Light", true); // 浅色主题下设置浮动栏为完全不透明 ViewboxFloatingBar.Opacity = 1.0; break; case 1: // 深色主题 - SetTheme("Dark"); + SetTheme("Dark", true); // 深色主题下设置浮动栏为完全不透明 ViewboxFloatingBar.Opacity = 1.0; break; case 2: // 跟随系统 if (IsSystemThemeLight()) { - SetTheme("Light"); + SetTheme("Light", true); ViewboxFloatingBar.Opacity = 1.0; } else { - SetTheme("Dark"); + SetTheme("Dark", true); ViewboxFloatingBar.Opacity = 1.0; } break; diff --git a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs index cd2f0c51..36542bc9 100644 --- a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs +++ b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs @@ -12,7 +12,7 @@ namespace Ink_Canvas { private Color FloatBarForegroundColor; - private void SetTheme(string theme) + private void SetTheme(string theme, bool autoSwitchIcon = false) { // 清理现有的主题资源 var resourcesToRemove = new List(); @@ -56,8 +56,11 @@ namespace Ink_Canvas // 刷新快速面板图标 RefreshQuickPanelIcons(); - - AutoSwitchFloatingBarIconForTheme("Light"); + + if (autoSwitchIcon) + { + AutoSwitchFloatingBarIconForTheme("Light"); + } // 强制刷新UI window.InvalidateVisual(); @@ -87,8 +90,10 @@ namespace Ink_Canvas // 刷新快速面板图标 RefreshQuickPanelIcons(); - // 自动切换浮动栏图标为深色呼吸版图标 - AutoSwitchFloatingBarIconForTheme("Dark"); + if (autoSwitchIcon) + { + AutoSwitchFloatingBarIconForTheme("Dark"); + } // 强制刷新UI window.InvalidateVisual();