improve:主题切换
This commit is contained in:
@@ -329,6 +329,7 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons-Fluent\ic_fluent_arrow_rotate_clockwise_24_regular.png" />
|
||||
<Resource Include="Resources\Icons-Fluent\ic_fluent_scale_fit_24_regular.png" />
|
||||
<Resource Include="Resources\Icons-Fluent\ic_fluent_scale_fit_24_regular_white.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Icons-Fluent\ic_fluent_scales_24_regular.png" />
|
||||
@@ -621,7 +622,6 @@
|
||||
<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" />
|
||||
|
||||
@@ -3986,7 +3986,7 @@
|
||||
CornerRadius="{Binding ElementName=BorderImageSelectionControl, Path=CornerRadius}"
|
||||
Width="40" MouseDown="Border_MouseDown" MouseUp="BorderImageClone_MouseUp">
|
||||
<ui:SimpleStackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_copy_24_regular.png"
|
||||
<Image Source="{DynamicResource ImageSelectionCloneIcon}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
|
||||
<TextBlock Text="克隆" FontSize="10" Foreground="{DynamicResource FloatBarForeground}"
|
||||
HorizontalAlignment="Center" />
|
||||
@@ -4002,7 +4002,7 @@
|
||||
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 ImageSelectionCloneToNewBoardIcon}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Height="25"
|
||||
Width="25" />
|
||||
@@ -4045,14 +4045,14 @@
|
||||
<ui:SimpleStackPanel VerticalAlignment="Center" Spacing="5" Margin="0,-10">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<Grid MouseDown="Border_MouseDown" MouseUp="GridImageScaleDecrease_MouseUp">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular.png"
|
||||
<Image Source="{DynamicResource ImageSelectionScaleIcon1}"
|
||||
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="GridImageScaleIncrease_MouseUp">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular.png"
|
||||
<Image Source="{DynamicResource ImageSelectionScaleIcon2}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
|
||||
<TextBlock Text="+" Foreground="{DynamicResource FloatBarForeground}"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Right"
|
||||
@@ -4069,7 +4069,7 @@
|
||||
CornerRadius="{Binding ElementName=BorderImageSelectionControl, Path=CornerRadius}"
|
||||
Width="40" MouseDown="Border_MouseDown" MouseUp="BorderImageDelete_MouseUp">
|
||||
<ui:SimpleStackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_delete_24_regular.png"
|
||||
<Image Source="{DynamicResource ImageSelectionDeleteIcon}"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="25" Width="25" />
|
||||
<TextBlock Margin="0,5,0,0" Text="删除" FontSize="10"
|
||||
Foreground="{DynamicResource FloatBarForeground}"
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace Ink_Canvas
|
||||
// 刷新墨迹选中栏图标
|
||||
RefreshStrokeSelectionIcons();
|
||||
|
||||
// 刷新图片选中栏图标
|
||||
RefreshImageSelectionIcons();
|
||||
|
||||
RefreshFloatingBarHighlightColors();
|
||||
|
||||
if (autoSwitchIcon)
|
||||
@@ -100,6 +103,9 @@ namespace Ink_Canvas
|
||||
// 刷新墨迹选中栏图标
|
||||
RefreshStrokeSelectionIcons();
|
||||
|
||||
// 刷新图片选中栏图标
|
||||
RefreshImageSelectionIcons();
|
||||
|
||||
RefreshFloatingBarHighlightColors();
|
||||
|
||||
if (autoSwitchIcon)
|
||||
@@ -410,5 +416,74 @@ namespace Ink_Canvas
|
||||
// 忽略异常
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新图片选中栏图标
|
||||
/// </summary>
|
||||
private void RefreshImageSelectionIcons()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (BorderImageSelectionControl != null)
|
||||
{
|
||||
// 强制刷新图片选中栏的视觉状态
|
||||
BorderImageSelectionControl.InvalidateVisual();
|
||||
|
||||
// 刷新图片选中栏内的所有图标
|
||||
var viewbox = BorderImageSelectionControl.Child as Viewbox;
|
||||
if (viewbox?.Child is ui.SimpleStackPanel stackPanel)
|
||||
{
|
||||
RefreshImageSelectionIconsRecursive(stackPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 忽略异常,确保主题切换不会因为图标刷新失败而中断
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归刷新图片选中栏内的图标
|
||||
/// </summary>
|
||||
private void RefreshImageSelectionIconsRecursive(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)
|
||||
{
|
||||
// 递归处理子面板
|
||||
RefreshImageSelectionIconsRecursive(childPanel);
|
||||
}
|
||||
else if (child is Border border && border.Child is System.Windows.Controls.Panel borderPanel)
|
||||
{
|
||||
// 处理Border内的面板
|
||||
RefreshImageSelectionIconsRecursive(borderPanel);
|
||||
}
|
||||
else if (child is Grid grid)
|
||||
{
|
||||
// 处理Grid内的子元素
|
||||
foreach (var gridChild in grid.Children)
|
||||
{
|
||||
if (gridChild is Image gridImage)
|
||||
{
|
||||
gridImage.InvalidateVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 忽略异常
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,13 @@
|
||||
<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="ImageSelectionCloneIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_24_regular_white.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionCloneToNewBoardIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular_white.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionScaleIcon1" UriSource="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular_white.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionScaleIcon2" UriSource="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular_white.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionDeleteIcon" 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"/>
|
||||
|
||||
@@ -57,6 +57,13 @@
|
||||
<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="ImageSelectionCloneIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_24_regular.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionCloneToNewBoardIcon" UriSource="/Resources/Icons-Fluent/ic_fluent_copy_add_24_regular.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionScaleIcon1" UriSource="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionScaleIcon2" UriSource="/Resources/Icons-Fluent/ic_fluent_scale_fit_24_regular.png"/>
|
||||
<BitmapImage x:Key="ImageSelectionDeleteIcon" 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"/>
|
||||
|
||||
Reference in New Issue
Block a user