improve:UI

This commit is contained in:
2026-05-01 21:58:09 +08:00
parent 31aee3bd9a
commit 4f5f3ed8fe
10 changed files with 268 additions and 194 deletions
@@ -38,6 +38,7 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
if (eng > 2) eng = 2;
ComboBoxShapeRecognitionEngine.SelectedIndex = eng;
CardEnableWinRtHandwritingStrokeBeautify.IsOn = settings.InkToShape.EnableWinRtHandwritingStrokeBeautify;
SelectHandwritingFontByValue(settings.InkToShape.HandwritingCorrectionFontFamily);
CardEnableInkToShapeNoFakePressureRectangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureRectangle;
CardEnableInkToShapeNoFakePressureTriangle.IsOn = settings.InkToShape.IsInkToShapeNoFakePressureTriangle;
ToggleCheckboxEnableInkToShapeTriangle.IsChecked = settings.InkToShape.IsInkToShapeTriangle;
@@ -97,6 +98,34 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
SettingsManager.SaveSettingsToFile();
}
private void SelectHandwritingFontByValue(string value)
{
if (ComboBoxHandwritingCorrectionFont == null) return;
value = (value ?? string.Empty).Trim();
int matchIndex = -1;
for (int i = 0; i < ComboBoxHandwritingCorrectionFont.Items.Count; i++)
{
var item = ComboBoxHandwritingCorrectionFont.Items[i] as ComboBoxItem;
var tag = item?.Tag as string;
if (!string.IsNullOrEmpty(tag) && string.Equals(tag, value, StringComparison.OrdinalIgnoreCase))
{
matchIndex = i;
break;
}
}
ComboBoxHandwritingCorrectionFont.SelectedIndex = matchIndex >= 0 ? matchIndex : 0;
}
private void ComboBoxHandwritingCorrectionFont_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!_isLoaded || ComboBoxHandwritingCorrectionFont == null) return;
var item = ComboBoxHandwritingCorrectionFont.SelectedItem as ComboBoxItem;
var tag = item?.Tag as string;
if (string.IsNullOrWhiteSpace(tag)) return;
SettingsManager.Settings.InkToShape.HandwritingCorrectionFontFamily = tag;
SettingsManager.SaveSettingsToFile();
}
private void ToggleSwitchEnableInkToShapeNoFakePressureRectangle_Toggled(object sender, RoutedEventArgs e)
{
if (!_isLoaded) return;