improve:主题切换

This commit is contained in:
2025-10-05 08:55:18 +08:00
parent 5c44062aa2
commit 793519ae1b
23 changed files with 98 additions and 8 deletions
+7
View File
@@ -624,6 +624,13 @@
<Resource Include="Resources\Startup-animation\ICC Autumn.png" />
<Resource Include="Resources\Startup-animation\ICC Winter.png" />
<Resource Include="Resources\Startup-animation\ICC Horse.png" />
<!-- 墨迹选中栏图标资源 - 白色版本 -->
<Resource Include="Resources\Icons-Fluent\ic_fluent_copy_24_regular_white.png" />
<Resource Include="Resources\Icons-Fluent\ic_fluent_copy_add_24_regular_white.png" />
<Resource Include="Resources\Icons-Fluent\ic_fluent_flip_horizontal_24_regular_white.png" />
<Resource Include="Resources\Icons-Fluent\ic_fluent_flip_vertical_24_regular_white.png" />
<Resource Include="Resources\Icons-Fluent\ic_fluent_edit_24_regular_white.png" />
<Resource Include="Resources\Icons-Fluent\ic_fluent_delete_24_regular_white.png" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
+8 -8
View File
@@ -3874,7 +3874,7 @@
CornerRadius="{Binding ElementName=BorderStrokeSelectionControl, Path=CornerRadius}"
Width="40" MouseDown="Border_MouseDown" MouseUp="BorderStrokeSelectionClone_MouseUp">
<ui:SimpleStackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="/Resources/Icons-Fluent/ic_fluent_copy_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionCloneIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<TextBlock Text="克隆" FontSize="10" Foreground="{DynamicResource FloatBarForeground}"
HorizontalAlignment="Center" />
@@ -3886,7 +3886,7 @@
MouseUp="BorderStrokeSelectionCloneToNewBoard_MouseUp"
Visibility="{Binding Visibility, ElementName=GridBackgroundCover}">
<ui:SimpleStackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionCloneToNewBoardIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<TextBlock Text="克隆至新页" FontSize="8" Foreground="{DynamicResource FloatBarForeground}"
HorizontalAlignment="Center" />
@@ -3914,10 +3914,10 @@
<ui:SimpleStackPanel VerticalAlignment="Center" Margin="0,-10">
<ui:SimpleStackPanel Orientation="Horizontal">
<Image MouseDown="Border_MouseDown" MouseUp="ImageFlipHorizontal_MouseUp"
Source="/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular.png"
Source="{DynamicResource StrokeSelectionFlipHorizontalIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="30" Width="30" />
<Image MouseDown="Border_MouseDown" MouseUp="ImageFlipVertical_MouseUp"
Source="/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular.png"
Source="{DynamicResource StrokeSelectionFlipVerticalIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="30" Width="30" />
</ui:SimpleStackPanel>
<TextBlock Text="翻转" FontSize="10" HorizontalAlignment="Center"
@@ -3931,21 +3931,21 @@
<ui:SimpleStackPanel VerticalAlignment="Center" Spacing="5" Margin="0,-10">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="5">
<Grid MouseDown="Border_MouseDown" MouseUp="GridPenWidthDecrease_MouseUp">
<Image Source="/Resources/Icons-Fluent/ic_fluent_edit_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionPenWidthIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<TextBlock Text="-" Foreground="{DynamicResource FloatBarForeground}"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="0,0,-2,-7" FontSize="15" />
</Grid>
<Grid MouseDown="Border_MouseDown" MouseUp="GridPenWidthIncrease_MouseUp">
<Image Source="/Resources/Icons-Fluent/ic_fluent_edit_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionPenWidthIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<TextBlock Text="+" Foreground="{DynamicResource FloatBarForeground}"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
Margin="0,0,-3,-4" FontSize="11" />
</Grid>
<Grid MouseDown="Border_MouseDown" MouseUp="GridPenWidthRestore_MouseUp">
<Image Source="/Resources/Icons-Fluent/ic_fluent_edit_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionPenWidthIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<Image Source="{DynamicResource AndroidRefreshDrawingImage}"
VerticalAlignment="Bottom" HorizontalAlignment="Right"
@@ -3962,7 +3962,7 @@
CornerRadius="{Binding ElementName=BorderStrokeSelectionControl, Path=CornerRadius}"
Width="40" MouseDown="Border_MouseDown" MouseUp="BorderStrokeSelectionDelete_MouseUp">
<ui:SimpleStackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="/Resources/Icons-Fluent/ic_fluent_delete_24_regular.png"
<Image Source="{DynamicResource StrokeSelectionDeleteIcon}"
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
<TextBlock Margin="0,5,0,0" Text="删除" FontSize="10"
Foreground="{DynamicResource FloatBarForeground}"
+65
View File
@@ -6,6 +6,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Application = System.Windows.Application;
using ui = iNKORE.UI.WPF.Modern.Controls;
namespace Ink_Canvas
{
@@ -58,6 +59,9 @@ namespace Ink_Canvas
// 刷新快速面板图标
RefreshQuickPanelIcons();
// 刷新墨迹选中栏图标
RefreshStrokeSelectionIcons();
RefreshFloatingBarHighlightColors();
if (autoSwitchIcon)
@@ -93,6 +97,9 @@ namespace Ink_Canvas
// 刷新快速面板图标
RefreshQuickPanelIcons();
// 刷新墨迹选中栏图标
RefreshStrokeSelectionIcons();
RefreshFloatingBarHighlightColors();
if (autoSwitchIcon)
@@ -345,5 +352,63 @@ namespace Ink_Canvas
{
}
}
/// <summary>
/// 刷新墨迹选中栏图标
/// </summary>
private void RefreshStrokeSelectionIcons()
{
try
{
if (BorderStrokeSelectionControl != null)
{
// 强制刷新墨迹选中栏的视觉状态
BorderStrokeSelectionControl.InvalidateVisual();
// 刷新墨迹选中栏内的所有图标
var viewbox = BorderStrokeSelectionControl.Child as Viewbox;
if (viewbox?.Child is ui.SimpleStackPanel stackPanel)
{
RefreshStrokeSelectionIconsRecursive(stackPanel);
}
}
}
catch (Exception)
{
// 忽略异常,确保主题切换不会因为图标刷新失败而中断
}
}
/// <summary>
/// 递归刷新墨迹选中栏内的图标
/// </summary>
private void RefreshStrokeSelectionIconsRecursive(System.Windows.Controls.Panel panel)
{
try
{
foreach (var child in panel.Children)
{
if (child is Image image)
{
// 强制刷新图像
image.InvalidateVisual();
}
else if (child is System.Windows.Controls.Panel childPanel)
{
// 递归处理子面板
RefreshStrokeSelectionIconsRecursive(childPanel);
}
else if (child is Border border && border.Child is System.Windows.Controls.Panel borderPanel)
{
// 处理Border内的面板
RefreshStrokeSelectionIconsRecursive(borderPanel);
}
}
}
catch (Exception)
{
// 忽略异常
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 11 KiB

+9
View File
@@ -48,6 +48,15 @@
<BitmapImage x:Key="QuickPanelPersonMoneyIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_person_money_24_regular-light.png"/>
<BitmapImage x:Key="QuickPanelPeopleMoneyIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_people_money_24_regular-light.png"/>
<BitmapImage x:Key="QuickPanelTimerIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_timer_24_regular-light.png"/>
<!-- 墨迹选中栏图标资源 -->
<BitmapImage x:Key="StrokeSelectionCloneIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_24_regular_white.png"/>
<BitmapImage x:Key="StrokeSelectionCloneToNewBoardIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular_white.png"/>
<BitmapImage x:Key="StrokeSelectionFlipHorizontalIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular_white.png"/>
<BitmapImage x:Key="StrokeSelectionFlipVerticalIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular_white.png"/>
<BitmapImage x:Key="StrokeSelectionPenWidthIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_edit_24_regular_white.png"/>
<BitmapImage x:Key="StrokeSelectionDeleteIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_delete_24_regular_white.png"/>
<BitmapImage x:Key="QuickPanelBlackboardIcon" UriSource="/Resources/new-icons/blackboard-light.png"/>
<BitmapImage x:Key="QuickPanelEndSlideshowIcon" UriSource="/Resources/new-icons/end-slides-show-light.png"/>
<BitmapImage x:Key="QuickPanelEyeIcon" UriSource="/Resources/new-icons/eye-light.png"/>
+9
View File
@@ -48,6 +48,15 @@
<BitmapImage x:Key="QuickPanelPersonMoneyIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_person_money_24_regular.png"/>
<BitmapImage x:Key="QuickPanelPeopleMoneyIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_people_money_24_regular.png"/>
<BitmapImage x:Key="QuickPanelTimerIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_timer_24_regular.png"/>
<!-- 墨迹选中栏图标资源 -->
<BitmapImage x:Key="StrokeSelectionCloneIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_24_regular.png"/>
<BitmapImage x:Key="StrokeSelectionCloneToNewBoardIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular.png"/>
<BitmapImage x:Key="StrokeSelectionFlipHorizontalIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_flip_horizontal_24_regular.png"/>
<BitmapImage x:Key="StrokeSelectionFlipVerticalIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_flip_vertical_24_regular.png"/>
<BitmapImage x:Key="StrokeSelectionPenWidthIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_edit_24_regular.png"/>
<BitmapImage x:Key="StrokeSelectionDeleteIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_delete_24_regular.png"/>
<BitmapImage x:Key="QuickPanelBlackboardIcon" UriSource="/Resources/new-icons/blackboard.png"/>
<BitmapImage x:Key="QuickPanelEndSlideshowIcon" UriSource="/Resources/new-icons/end-slides-show.png"/>
<BitmapImage x:Key="QuickPanelEyeIcon" UriSource="/Resources/new-icons/eye.png"/>