From 98915bcff2c079e02b89a087812337fb15148d26 Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Sat, 4 Oct 2025 17:32:17 +0800
Subject: [PATCH] =?UTF-8?q?improve:=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/MainWindow_cs/MW_AutoTheme.cs | 48 +++++++++++++++++++
.../MainWindow_cs/MW_FloatingBarIcons.cs | 1 -
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs
index eb586f50..6d0ec25b 100644
--- a/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs
+++ b/Ink Canvas/MainWindow_cs/MW_AutoTheme.cs
@@ -3,6 +3,7 @@ using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Windows;
+using System.Windows.Controls;
using System.Windows.Media;
using Application = System.Windows.Application;
@@ -57,6 +58,8 @@ namespace Ink_Canvas
// 刷新快速面板图标
RefreshQuickPanelIcons();
+ RefreshFloatingBarHighlightColors();
+
if (autoSwitchIcon)
{
AutoSwitchFloatingBarIconForTheme("Light");
@@ -90,6 +93,8 @@ namespace Ink_Canvas
// 刷新快速面板图标
RefreshQuickPanelIcons();
+ RefreshFloatingBarHighlightColors();
+
if (autoSwitchIcon)
{
AutoSwitchFloatingBarIconForTheme("Dark");
@@ -148,6 +153,49 @@ namespace Ink_Canvas
}
}
+ ///
+ /// 刷新浮动栏高光条颜色
+ ///
+ private void RefreshFloatingBarHighlightColors()
+ {
+ try
+ {
+ if (FloatingbarSelectionBG != null && FloatingbarSelectionBG.Visibility == Visibility.Visible)
+ {
+ // 根据主题设置高光颜色
+ Color highlightBackgroundColor;
+ Color highlightBarColor;
+ bool isDarkTheme = Settings.Appearance.Theme == 1 ||
+ (Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
+
+ if (isDarkTheme)
+ {
+ highlightBackgroundColor = Color.FromArgb(21, 102, 204, 255);
+ highlightBarColor = Color.FromRgb(102, 204, 255);
+ }
+ else
+ {
+ highlightBackgroundColor = Color.FromArgb(21, 59, 130, 246);
+ highlightBarColor = Color.FromRgb(37, 99, 235);
+ }
+
+ // 设置高光背景颜色
+ FloatingbarSelectionBG.Background = new SolidColorBrush(highlightBackgroundColor);
+ if (FloatingbarSelectionBG.Child is System.Windows.Controls.Canvas canvas && canvas.Children.Count > 0)
+ {
+ var firstChild = canvas.Children[0];
+ if (firstChild is Border innerBorder)
+ {
+ innerBorder.Background = new SolidColorBrush(highlightBarColor);
+ }
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+
///
/// 刷新浮动工具栏按钮颜色
///
diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
index fc90338a..d83f45e8 100644
--- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -3733,7 +3733,6 @@ namespace Ink_Canvas
// 设置高光背景颜色
FloatingbarSelectionBG.Background = new SolidColorBrush(highlightBackgroundColor);
-
if (FloatingbarSelectionBG.Child is System.Windows.Controls.Canvas canvas && canvas.Children.Count > 0)
{
var firstChild = canvas.Children[0];