From 057fb35d00f7285140edf3fb7b896f0a1e35c7ca Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Sun, 5 Apr 2026 22:03:16 +0800
Subject: [PATCH] improve:UI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
快捷键设置UI改进
---
Ink Canvas/Windows/HotkeyItem.xaml | 106 ++--
Ink Canvas/Windows/HotkeyItem.xaml.cs | 16 +-
Ink Canvas/Windows/HotkeySettingsWindow.xaml | 546 +++++++++++-------
.../Windows/HotkeySettingsWindow.xaml.cs | 5 -
4 files changed, 418 insertions(+), 255 deletions(-)
diff --git a/Ink Canvas/Windows/HotkeyItem.xaml b/Ink Canvas/Windows/HotkeyItem.xaml
index 0f2ff92a..3cfc5b1e 100644
--- a/Ink Canvas/Windows/HotkeyItem.xaml
+++ b/Ink Canvas/Windows/HotkeyItem.xaml
@@ -1,66 +1,70 @@
-
-
-
+ mc:Ignorable="d"
+ d:DesignHeight="60"
+ d:DesignWidth="600">
+
+
+
-
-
-
+
+
+
-
-
-
+
+
-
-
-
+
+
-
-
+ VerticalAlignment="Center"
+ Style="{DynamicResource PrimaryButtonStyle}"
+ Padding="12,4"
+ Click="BtnSetHotkey_Click" />
-
\ No newline at end of file
+
diff --git a/Ink Canvas/Windows/HotkeyItem.xaml.cs b/Ink Canvas/Windows/HotkeyItem.xaml.cs
index 47bce516..7cbd2856 100644
--- a/Ink Canvas/Windows/HotkeyItem.xaml.cs
+++ b/Ink Canvas/Windows/HotkeyItem.xaml.cs
@@ -11,6 +11,16 @@ namespace Ink_Canvas.Windows
///
public partial class HotkeyItem : UserControl
{
+ private static readonly SolidColorBrush HotkeyValueForeground = CreateFrozenBrush(0xFA, 0xFA, 0xFA);
+ private static readonly SolidColorBrush HotkeyPlaceholderForeground = CreateFrozenBrush(0xA1, 0xA1, 0xAA);
+
+ private static SolidColorBrush CreateFrozenBrush(byte r, byte g, byte b)
+ {
+ var brush = new SolidColorBrush(Color.FromRgb(r, g, b));
+ brush.Freeze();
+ return brush;
+ }
+
#region Events
///
/// 快捷键变更事件
@@ -80,13 +90,13 @@ namespace Ink_Canvas.Windows
if (_currentKey == Key.None)
{
CurrentHotkeyTextBlock.Text = "未设置";
- CurrentHotkeyTextBlock.Foreground = Brushes.Gray;
+ CurrentHotkeyTextBlock.Foreground = HotkeyPlaceholderForeground;
}
else
{
var modifiersText = _currentModifiers == ModifierKeys.None ? "" : $"{_currentModifiers}+";
CurrentHotkeyTextBlock.Text = $"{modifiersText}{_currentKey}";
- CurrentHotkeyTextBlock.Foreground = Brushes.Black;
+ CurrentHotkeyTextBlock.Foreground = HotkeyValueForeground;
}
}
@@ -106,7 +116,7 @@ namespace Ink_Canvas.Windows
private void StopHotkeyCapture()
{
BtnSetHotkey.Content = "设置";
- BtnSetHotkey.Background = Brushes.DodgerBlue;
+ BtnSetHotkey.ClearValue(Button.BackgroundProperty);
// 移除键盘事件处理器
KeyDown -= HotkeyItem_KeyDown;
diff --git a/Ink Canvas/Windows/HotkeySettingsWindow.xaml b/Ink Canvas/Windows/HotkeySettingsWindow.xaml
index 249de7b1..18d6518e 100644
--- a/Ink Canvas/Windows/HotkeySettingsWindow.xaml
+++ b/Ink Canvas/Windows/HotkeySettingsWindow.xaml
@@ -6,216 +6,370 @@
xmlns:local="clr-namespace:Ink_Canvas.Windows"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
- ui:ThemeManager.RequestedTheme="Light"
- Background="#F9F9F9"
- AllowsTransparency="True"
- mc:Ignorable="d"
- WindowStyle="None"
+ mc:Ignorable="d"
+ Title="快捷键设置"
+ Height="600"
+ Width="800"
WindowStartupLocation="CenterScreen"
ResizeMode="CanResize"
- Title="快捷键设置"
- Height="600"
- Width="800">
-
+ FontFamily="Microsoft YaHei UI"
+ ui:ThemeManager.IsThemeAware="True"
+ ui:TitleBar.ExtendViewIntoTitleBar="True"
+ ui:WindowHelper.SystemBackdropType="Mica"
+ ui:WindowHelper.UseModernWindowStyle="True"
+ ui:TitleBar.Height="48">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/Ink Canvas/Windows/HotkeySettingsWindow.xaml.cs b/Ink Canvas/Windows/HotkeySettingsWindow.xaml.cs
index e0af19bc..e59528d5 100644
--- a/Ink Canvas/Windows/HotkeySettingsWindow.xaml.cs
+++ b/Ink Canvas/Windows/HotkeySettingsWindow.xaml.cs
@@ -541,11 +541,6 @@ namespace Ink_Canvas.Windows
#endregion
#region Event Handlers
- private void BtnClose_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
-
///
/// 标题栏拖拽事件
///