add:快捷调色盘

This commit is contained in:
2025-08-12 11:08:24 +08:00
parent b20dbc5202
commit 636dd2b8d5
4 changed files with 519 additions and 289 deletions
+403 -283
View File
@@ -6189,7 +6189,7 @@
<Grid Name="FloatingbarUIForInkReplay">
<Viewbox Name="ViewboxFloatingBar" Margin="100,5,0,0" Cursor="Arrow"
HorizontalAlignment="Left" Height="58" VerticalAlignment="Top" Width="733"
HorizontalAlignment="Left" Height="58" VerticalAlignment="Top" Width="850"
RenderTransformOrigin="0.5,0.5">
<Viewbox.LayoutTransform>
<ScaleTransform x:Name="ViewboxFloatingBarScaleTransform" ScaleX="1" ScaleY="1" />
@@ -6267,290 +6267,410 @@
<!-- 快捷调色盘 -->
<ui:SimpleStackPanel Name="QuickColorPalettePanel"
Visibility="Collapsed"
Orientation="Horizontal"
Orientation="Vertical"
HorizontalAlignment="Center"
Margin="4,0,4,0">
<!-- 白色 -->
<Border Name="QuickColorWhite"
Width="16" Height="16"
Background="White"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorWhite_Click"
ToolTip="白色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorWhiteGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#FF6B35"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorWhiteGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
Margin="4,0,4,0"
Width="60"
Height="42"
MaxWidth="60"
MaxHeight="42">
<!-- 第一行:黑、白、红、橙 -->
<ui:SimpleStackPanel Orientation="Horizontal" Margin="0,0,0,2">
<!-- 黑色 -->
<Border Name="QuickColorBlack"
Width="13" Height="13"
Background="Black"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorBlack_Click"
ToolTip="黑色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorBlackGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#00FFFF"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorBlackGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 白色 -->
<Border Name="QuickColorWhite"
Width="13" Height="13"
Background="White"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorWhite_Click"
ToolTip="白色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorWhiteGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#FF6B35"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorWhiteGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 红色 -->
<Border Name="QuickColorRed"
Width="13" Height="13"
Background="#FF0000"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorRed_Click"
ToolTip="红色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorRedGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#00FF00"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorRedGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 橙色 -->
<Border Name="QuickColorOrange"
Width="13" Height="13"
Background="#FFA500"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorOrange_Click"
ToolTip="橙色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorOrangeGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#00FF00"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorOrangeGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
</ui:SimpleStackPanel>
<!-- 橙色 -->
<Border Name="QuickColorOrange"
Width="16" Height="16"
Background="#FFA500"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorOrange_Click"
ToolTip="橙色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorOrangeGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#00FF00"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorOrangeGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 黄色 -->
<Border Name="QuickColorYellow"
Width="16" Height="16"
Background="#FFFF00"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorYellow_Click"
ToolTip="黄色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorYellowGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#FF0000"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorYellowGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 黑色 -->
<Border Name="QuickColorBlack"
Width="16" Height="16"
Background="Black"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorBlack_Click"
ToolTip="黑色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorBlackGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#00FFFF"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorBlackGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 蓝色 -->
<Border Name="QuickColorBlue"
Width="16" Height="16"
Background="#0066FF"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorBlue_Click"
ToolTip="蓝色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorBlueGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#FF00FF"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorBlueGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 红色 -->
<Border Name="QuickColorRed"
Width="16" Height="16"
Background="#FF0000"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="8"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorRed_Click"
ToolTip="红色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Ellipse Name="QuickColorRedGlow"
Width="22" Height="22"
Fill="Transparent"
Stroke="#00FF00"
StrokeThickness="3"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Ellipse Name="QuickColorRedGlowShadow"
Width="24" Height="24"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="2"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 第二行:黄、绿、蓝、紫 -->
<ui:SimpleStackPanel Orientation="Horizontal" Margin="0,2,0,0">
<!-- 黄色 -->
<Border Name="QuickColorYellow"
Width="13" Height="13"
Background="#FFFF00"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorYellow_Click"
ToolTip="黄色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorYellowGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#FF0000"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorYellowGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 绿色 -->
<Border Name="QuickColorGreen"
Width="13" Height="13"
Background="#00FF00"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorGreen_Click"
ToolTip="绿色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorGreenGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#FF0000"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorGreenGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 蓝色 -->
<Border Name="QuickColorBlue"
Width="13" Height="13"
Background="#0066FF"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorBlue_Click"
ToolTip="蓝色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorBlueGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#FF00FF"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorBlueGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- 紫色 -->
<Border Name="QuickColorPurple"
Width="13" Height="13"
Background="#800080"
BorderBrush="#CCCCCC"
BorderThickness="1"
CornerRadius="3"
Margin="1,0,1,0"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="QuickColorPurple_Click"
ToolTip="紫色">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#666666"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<!-- 高光效果容器 -->
<Grid>
<!-- 高光效果 -->
<Rectangle Name="QuickColorPurpleGlow"
Width="17" Height="17"
Fill="Transparent"
Stroke="#00FFFF"
StrokeThickness="2"
RadiusX="4" RadiusY="4"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!-- 外圈阴影效果 -->
<Rectangle Name="QuickColorPurpleGlowShadow"
Width="19" Height="19"
Fill="Transparent"
Stroke="#FFD700"
StrokeThickness="1"
RadiusX="5" RadiusY="5"
Opacity="1.0"
Visibility="Collapsed"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</Border>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Name="SymbolIconDelete"
+7 -1
View File
@@ -73,8 +73,14 @@ namespace Ink_Canvas
ViewBoxStackPanelMain.Visibility = Visibility.Collapsed;
ViewBoxStackPanelShapes.Visibility = Visibility.Collapsed;
var workingArea = Screen.PrimaryScreen.WorkingArea;
// 考虑快捷调色盘的宽度,确保浮动栏有足够空间
double floatingBarWidth = 284; // 基础宽度
if (Settings.Appearance.IsShowQuickColorPalette)
{
floatingBarWidth = Math.Max(floatingBarWidth, 820); // 快捷调色盘显示时的宽度
}
ViewboxFloatingBar.Margin = new Thickness(
(workingArea.Width - 284) / 2,
(workingArea.Width - floatingBarWidth) / 2,
workingArea.Bottom - 60 - workingArea.Top,
-2000, -200);
ViewboxFloatingBarMarginAnimation(100, true);
@@ -831,6 +831,12 @@ namespace Ink_Canvas
case "QuickColorRed":
border.Background = new SolidColorBrush(Colors.Red);
break;
case "QuickColorGreen":
border.Background = new SolidColorBrush(Colors.Green);
break;
case "QuickColorPurple":
border.Background = new SolidColorBrush(Color.FromRgb(128, 0, 128));
break;
}
}
else
@@ -1262,7 +1268,18 @@ namespace Ink_Canvas
double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY;
// 仅计算Windows任务栏高度,不考虑其他程序对工作区的影响
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2;
// 计算浮动栏位置,考虑快捷调色盘的显示状态
double floatingBarWidth = ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX;
// 如果快捷调色盘显示,确保有足够空间
if (QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible)
{
// 确保浮动栏有足够宽度容纳快捷调色盘
floatingBarWidth = Math.Max(floatingBarWidth, 820 * ViewboxFloatingBarScaleTransform.ScaleX);
}
pos.X = (screenWidth - floatingBarWidth) / 2;
if (PosXCaculatedWithTaskbarHeight == false)
{
@@ -1356,7 +1373,18 @@ namespace Ink_Canvas
double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY;
// 仅计算Windows任务栏高度,不考虑其他程序对工作区的影响
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2;
// 计算浮动栏位置,考虑快捷调色盘的显示状态
double floatingBarWidth = ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX;
// 如果快捷调色盘显示,确保有足够空间
if (QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible)
{
// 确保浮动栏有足够宽度容纳快捷调色盘
floatingBarWidth = Math.Max(floatingBarWidth, 820 * ViewboxFloatingBarScaleTransform.ScaleX);
}
pos.X = (screenWidth - floatingBarWidth) / 2;
// 如果任务栏高度为0(隐藏状态),则使用固定边距
if (toolbarHeight == 0)
@@ -1411,7 +1439,18 @@ namespace Ink_Canvas
double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY;
// 仅计算Windows任务栏高度,不考虑其他程序对工作区的影响
var toolbarHeight = ForegroundWindowInfo.GetTaskbarHeight(screen, dpiScaleY);
pos.X = (screenWidth - ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX) / 2;
// 计算浮动栏位置,考虑快捷调色盘的显示状态
double floatingBarWidth = ViewboxFloatingBar.ActualWidth * ViewboxFloatingBarScaleTransform.ScaleX;
// 如果快捷调色盘显示,确保有足够空间
if (QuickColorPalettePanel != null && QuickColorPalettePanel.Visibility == Visibility.Visible)
{
// 确保浮动栏有足够宽度容纳快捷调色盘
floatingBarWidth = Math.Max(floatingBarWidth, 820 * ViewboxFloatingBarScaleTransform.ScaleX);
}
pos.X = (screenWidth - floatingBarWidth) / 2;
pos.Y = screenHeight - 55 * ViewboxFloatingBarScaleTransform.ScaleY;
@@ -1524,6 +1563,12 @@ namespace Ink_Canvas
StackPanelCanvasControls.Visibility = Visibility.Collapsed;
// 在鼠标模式下隐藏快捷调色盘
if (QuickColorPalettePanel != null)
{
QuickColorPalettePanel.Visibility = Visibility.Collapsed;
}
if (!isFloatingBarFolded)
{
@@ -1600,6 +1645,12 @@ namespace Ink_Canvas
//AnimationsHelper.ShowWithSlideFromLeftAndFade(StackPanelCanvasControls);
CheckEnableTwoFingerGestureBtnVisibility(true);
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
// 在批注模式下显示快捷调色盘(如果设置中启用了)
if (Settings.Appearance.IsShowQuickColorPalette && QuickColorPalettePanel != null)
{
QuickColorPalettePanel.Visibility = Visibility.Visible;
}
// 修复:从线擦切换到批注时,重置为默认笔模式(非高光显示)
forceEraser = false;
@@ -1849,6 +1900,16 @@ namespace Ink_Canvas
SetQuickColor(Colors.Red);
}
private void QuickColorGreen_Click(object sender, RoutedEventArgs e)
{
SetQuickColor(Colors.Green);
}
private void QuickColorPurple_Click(object sender, RoutedEventArgs e)
{
SetQuickColor(Color.FromRgb(128, 0, 128));
}
private void SetQuickColor(Color color)
{
// 确保当前处于批注模式
@@ -1871,6 +1932,8 @@ namespace Ink_Canvas
else if (color == Colors.Black) lastDesktopInkColor = 0;
else if (color == Color.FromRgb(0, 102, 255)) lastDesktopInkColor = 3; // 蓝色
else if (color == Colors.Red) lastDesktopInkColor = 1;
else if (color == Colors.Green) lastDesktopInkColor = 2; // 绿色
else if (color == Color.FromRgb(128, 0, 128)) lastDesktopInkColor = 6; // 紫色
}
else
{
@@ -1881,6 +1944,8 @@ namespace Ink_Canvas
else if (color == Colors.Black) lastBoardInkColor = 0;
else if (color == Color.FromRgb(0, 102, 255)) lastBoardInkColor = 3; // 蓝色
else if (color == Colors.Red) lastBoardInkColor = 1;
else if (color == Colors.Green) lastBoardInkColor = 2; // 绿色
else if (color == Color.FromRgb(128, 0, 128)) lastBoardInkColor = 6; // 紫色
}
// 更新快捷调色盘选择指示器
@@ -1905,6 +1970,10 @@ namespace Ink_Canvas
QuickColorBlueGlowShadow.Visibility = Visibility.Collapsed;
QuickColorRedGlow.Visibility = Visibility.Collapsed;
QuickColorRedGlowShadow.Visibility = Visibility.Collapsed;
QuickColorGreenGlow.Visibility = Visibility.Collapsed;
QuickColorGreenGlowShadow.Visibility = Visibility.Collapsed;
QuickColorPurpleGlow.Visibility = Visibility.Collapsed;
QuickColorPurpleGlowShadow.Visibility = Visibility.Collapsed;
// 显示当前选中颜色的高光效果和外圈阴影
// 使用更精确的颜色匹配,减少容差范围避免误判
@@ -1947,6 +2016,20 @@ namespace Ink_Canvas
QuickColorRedGlow.Visibility = Visibility.Visible;
QuickColorRedGlowShadow.Visibility = Visibility.Visible;
}
else if (IsColorSimilar(selectedColor, Colors.Green, 15) ||
IsColorSimilar(selectedColor, Color.FromRgb(34, 197, 94), 15) ||
IsColorSimilar(selectedColor, Color.FromRgb(22, 163, 74), 15))
{
QuickColorGreenGlow.Visibility = Visibility.Visible;
QuickColorGreenGlowShadow.Visibility = Visibility.Visible;
}
else if (IsColorSimilar(selectedColor, Color.FromRgb(128, 0, 128), 15) ||
IsColorSimilar(selectedColor, Color.FromRgb(147, 51, 234), 15) ||
IsColorSimilar(selectedColor, Color.FromRgb(168, 85, 247), 15))
{
QuickColorPurpleGlow.Visibility = Visibility.Visible;
QuickColorPurpleGlowShadow.Visibility = Visibility.Visible;
}
}
/// <summary>
+23 -2
View File
@@ -2452,9 +2452,30 @@ namespace Ink_Canvas
if (Fold_Icon != null)
Fold_Icon.Visibility = Settings.Appearance.IsShowHideButton ? Visibility.Visible : Visibility.Collapsed;
// 快捷调色盘
// 快捷调色盘
if (QuickColorPalettePanel != null)
QuickColorPalettePanel.Visibility = Settings.Appearance.IsShowQuickColorPalette ? Visibility.Visible : Visibility.Collapsed;
{
bool shouldShow = Settings.Appearance.IsShowQuickColorPalette && inkCanvas.EditingMode == InkCanvasEditingMode.Ink;
bool wasVisible = QuickColorPalettePanel.Visibility == Visibility.Visible;
if (shouldShow)
{
QuickColorPalettePanel.Visibility = Visibility.Visible;
}
else
{
QuickColorPalettePanel.Visibility = Visibility.Collapsed;
}
// 如果快捷调色盘的可见性发生变化,重新计算浮动栏位置
if (wasVisible != shouldShow && !isFloatingBarFolded)
{
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
ViewboxFloatingBarMarginAnimation(60);
else
ViewboxFloatingBarMarginAnimation(100, true);
}
}
// 套索选择按钮
if (SymbolIconSelect != null)