From 55eb8111930769a9b533a6e391b3bb2eb8cbd7ac Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 28 Mar 2026 17:11:30 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=AE=9E=E6=97=B6=E7=AC=94=E9=94=8B?= =?UTF-8?q?=E5=8F=8A=E5=A2=A8=E8=BF=B9=E9=A2=84=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml | 14 +++---- Ink Canvas/MainWindow_cs/MW_Settings.cs | 41 +++++++++++++++---- Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs | 5 ++- Ink Canvas/Resources/Settings.cs | 2 +- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index a53db6da..4dc1790a 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -1128,7 +1128,7 @@ + Foreground="#a1a1aa" HorizontalAlignment="Stretch" /> @@ -5634,16 +5634,16 @@ VerticalAlignment="Center" Name="BoardComboBoxPenStyle" FontFamily="Microsoft YaHei UI" - SelectedIndex="0" + SelectedIndex="1" SelectionChanged="ComboBoxPenStyle_SelectionChanged"> + - + - diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index 1c318354..41415488 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -2784,19 +2784,44 @@ namespace Ink_Canvas #region Canvas + /// 笔锋下拉 UI 顺序:0 实时笔锋,1 基于点集,2 基于速率,3 关闭。与存储值 InkStyle:3,0,1,2 对应。 + private static int PenStyleUiIndexFromInkStyle(int inkStyle) + { + switch (inkStyle) + { + case 3: return 0; + case 0: return 1; + case 1: return 2; + case 2: return 3; + default: return 1; + } + } + + private static int InkStyleFromPenStyleUiIndex(int uiIndex) + { + switch (uiIndex) + { + case 0: return 3; + case 1: return 0; + case 2: return 1; + case 3: return 2; + default: return 0; + } + } + private void ComboBoxPenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!isLoaded) return; + int uiIndex = sender == ComboBoxPenStyle + ? ComboBoxPenStyle.SelectedIndex + : BoardComboBoxPenStyle.SelectedIndex; + if (uiIndex < 0) return; + + Settings.Canvas.InkStyle = InkStyleFromPenStyleUiIndex(uiIndex); if (sender == ComboBoxPenStyle) - { - Settings.Canvas.InkStyle = ComboBoxPenStyle.SelectedIndex; - BoardComboBoxPenStyle.SelectedIndex = ComboBoxPenStyle.SelectedIndex; - } + BoardComboBoxPenStyle.SelectedIndex = uiIndex; else - { - Settings.Canvas.InkStyle = BoardComboBoxPenStyle.SelectedIndex; - ComboBoxPenStyle.SelectedIndex = BoardComboBoxPenStyle.SelectedIndex; - } + ComboBoxPenStyle.SelectedIndex = uiIndex; SaveSettingsToFile(); } diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs index f6249d67..2a3e9247 100644 --- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs +++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs @@ -833,8 +833,9 @@ namespace Ink_Canvas if (Settings.Canvas.InkStyle < 0 || Settings.Canvas.InkStyle > 3) Settings.Canvas.InkStyle = 0; - ComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; - BoardComboBoxPenStyle.SelectedIndex = Settings.Canvas.InkStyle; + int penStyleUi = PenStyleUiIndexFromInkStyle(Settings.Canvas.InkStyle); + ComboBoxPenStyle.SelectedIndex = penStyleUi; + BoardComboBoxPenStyle.SelectedIndex = penStyleUi; ComboBoxEraserSize.SelectedIndex = Settings.Canvas.EraserSize; ComboBoxEraserSizeFloatingBar.SelectedIndex = Settings.Canvas.EraserSize; diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs index 418544e1..f6fe9229 100644 --- a/Ink Canvas/Resources/Settings.cs +++ b/Ink Canvas/Resources/Settings.cs @@ -69,7 +69,7 @@ namespace Ink_Canvas public double InkAlpha { get; set; } = 255; [JsonProperty("isShowCursor")] public bool IsShowCursor { get; set; } - /// 笔锋:0 基于点集,1 基于速率,2 关闭,3 实时(速度与压感混合)。 + /// 笔锋存储值:0 基于点集,1 基于速率,2 关闭,3 实时笔锋(速度与压感混合)。界面下拉顺序为实时笔锋、点集、速率、关闭。 [JsonProperty("inkStyle")] public int InkStyle { get; set; } [JsonProperty("eraserSize")]