This commit is contained in:
2025-08-23 21:39:21 +08:00
parent 7bac32e3c4
commit f67b4db4ba
562 changed files with 37981 additions and 38280 deletions
+784
View File
@@ -0,0 +1,784 @@
<UserControl x:Class="Ink_Canvas.Popups.ColorPalette"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:colorPicker="clr-namespace:ColorPicker;assembly=ColorPicker"
xmlns:helpers="clr-namespace:Ink_Canvas.Helpers"
mc:Ignorable="d" Width="300" Height="462" UseLayoutRounding="True">
<UserControl.Resources>
<DrawingImage x:Key="CheckedLightIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M20.7071,6.29289C21.0976,6.68342,21.0976,7.31658,20.7071,7.70711L10.7071,17.7071C10.3166,18.0976,9.68342,18.0976,9.29289,17.7071L4.29289,12.7071C3.90237,12.3166 3.90237,11.6834 4.29289,11.2929 4.68342,10.9024 5.31658,10.9024 5.70711,11.2929L10,15.5858 19.2929,6.29289C19.6834,5.90237,20.3166,5.90237,20.7071,6.29289z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="CheckedDarkIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M20.7071,6.29289C21.0976,6.68342,21.0976,7.31658,20.7071,7.70711L10.7071,17.7071C10.3166,18.0976,9.68342,18.0976,9.29289,17.7071L4.29289,12.7071C3.90237,12.3166 3.90237,11.6834 4.29289,11.2929 4.68342,10.9024 5.31658,10.9024 5.70711,11.2929L10,15.5858 19.2929,6.29289C19.6834,5.90237,20.3166,5.90237,20.7071,6.29289z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<ContextMenu x:Key="InkRecognitionContextMenu" Placement="Absolute" Closed="InkRecognitionContextMenu_Closed" Opened="InkRecognitionContextMenu_Opened">
<MenuItem IsCheckable="True" Name="EnableRecog" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="启用墨迹转形状" />
<Separator />
<MenuItem IsCheckable="True" Name="RecogTri" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别三角形" />
<MenuItem IsCheckable="True" Name="RecogQua" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别四边形" />
<MenuItem IsCheckable="True" Name="RecogEll" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别椭圆" />
<MenuItem IsCheckable="True" Name="RecogPlg" Checked="InkRecognitionContextMenuItem_Checked" Unchecked="InkRecognitionContextMenuItem_Checked" Header="识别多边形" />
</ContextMenu>
<ContextMenu x:Key="SimulatePressureContextMenu" Placement="Absolute" Closed="SimulatePressureContextMenu_Closed" Opened="SimulatePressureContextMenu_Opened">
<MenuItem IsCheckable="True" Name="PointSP" Checked="SimulatePressureContextMenuItem_Checked" Unchecked="SimulatePressureContextMenuItem_Checked" Header="点集笔锋" />
<MenuItem IsCheckable="True" Name="VelocitySP" Checked="SimulatePressureContextMenuItem_Checked" Unchecked="SimulatePressureContextMenuItem_Checked" Header="速度笔锋" />
<MenuItem IsCheckable="True" Name="NoneSP" Checked="SimulatePressureContextMenuItem_Checked" Unchecked="SimulatePressureContextMenuItem_Checked" Header="强制硬件压感" />
</ContextMenu>
<DrawingImage x:Key="TransparentBackgroundImage">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V144 H144 V0 H0 Z">
<DrawingGroup Opacity="1">
<DrawingGroup.ClipGeometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,144,144" />
</DrawingGroup.ClipGeometry>
<GeometryDrawing Brush="#FFFFFFFF">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,144,144" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="32,0,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="64,0,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="96,0,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="16,16,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="48,16,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="80,16,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="112,16,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,32,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="32,32,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="64,32,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="96,32,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="16,48,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="48,48,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="80,48,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="112,48,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,64,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="32,64,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="64,64,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="96,64,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="16,80,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="48,80,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="80,80,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="112,80,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,96,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="32,96,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="64,96,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="96,96,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="16,112,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="48,112,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="80,112,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="112,112,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,128,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="32,128,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="64,128,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="96,128,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="128,0,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="128,32,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="128,64,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="128,96,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFD9D9D9">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="128,128,16,16" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingGroup>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="SwitchOnImage">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V20 H53 V0 H0 Z">
<GeometryDrawing Brush="#FFEBECF0">
<GeometryDrawing.Pen>
<Pen Brush="#FFC9CCD6" Thickness="1" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="2.5" RadiusY="2.5" Rect="0.5,0.5,52,19" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FF208A3C" Geometry="F1 M53,20z M0,0z M1,3C1,1.89543,1.89543,1,3,1L35,1 35,19 3,19C1.89543,19,1,18.1046,1,17L1,3z" />
<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M53,20z M0,0z M17.2513,10.2726C17.2513,11.282 17.0666,12.1499 16.6973,12.8762 16.328,13.5995 15.8217,14.1565 15.1785,14.5474 14.5383,14.9352 13.8105,15.1291 12.9949,15.1291 12.1762,15.1291 11.4453,14.9352 10.8021,14.5474 10.1619,14.1565 9.65718,13.598 9.28786,12.8716 8.91855,12.1453 8.73389,11.2789 8.73389,10.2726 8.73389,9.26308 8.91855,8.39672 9.28786,7.67347 9.65718,6.94715 10.1619,6.39009 10.8021,6.00231 11.4453,5.61145 12.1762,5.41602 12.9949,5.41602 13.8105,5.41602 14.5383,5.61145 15.1785,6.00231 15.8217,6.39009 16.328,6.94715 16.6973,7.67347 17.0666,8.39672 17.2513,9.26308 17.2513,10.2726z M15.8386,10.2726C15.8386,9.50314 15.714,8.85529 15.4647,8.32901 15.2185,7.79966 14.88,7.39956 14.4491,7.12873 14.0213,6.85482 13.5366,6.71786 12.9949,6.71786 12.4502,6.71786 11.9639,6.85482 11.5361,7.12873 11.1083,7.39956 10.7698,7.79966 10.5205,8.32901 10.2743,8.85529 10.1511,9.50314 10.1511,10.2726 10.1511,11.042 10.2743,11.6913 10.5205,12.2207 10.7698,12.747 11.1083,13.1471 11.5361,13.421 11.9639,13.6918 12.4502,13.8272 12.9949,13.8272 13.5366,13.8272 14.0213,13.6918 14.4491,13.421 14.88,13.1471 15.2185,12.747 15.4647,12.2207 15.714,11.6913 15.8386,11.042 15.8386,10.2726z" />
<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M53,20z M0,0z M26.6608,5.54528L26.6608,14.9998 25.3497,14.9998 20.544,8.06587 20.4563,8.06587 20.4563,14.9998 19.0298,14.9998 19.0298,5.54528 20.3501,5.54528 25.1605,12.4885 25.2482,12.4885 25.2482,5.54528 26.6608,5.54528z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="SwitchOffImage">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V20 H53 V0 H0 Z">
<GeometryDrawing Brush="#FFC9CCD6">
<GeometryDrawing.Geometry>
<RectangleGeometry RadiusX="3" RadiusY="3" Rect="0,0,53,20" />
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="#FFEBECF0" Geometry="F1 M53,20z M0,0z M18,1L50,1C51.1046,1,52,1.89543,52,3L52,17C52,18.1046,51.1046,19,50,19L18,19 18,1z" />
<GeometryDrawing Brush="#FF6C707E" Geometry="F1 M53,20z M0,0z M31.2513,10.2726C31.2513,11.282 31.0666,12.1499 30.6973,12.8762 30.328,13.5995 29.8217,14.1565 29.1785,14.5474 28.5383,14.9352 27.8105,15.1291 26.9949,15.1291 26.1762,15.1291 25.4453,14.9352 24.8021,14.5474 24.1619,14.1565 23.6572,13.598 23.2879,12.8716 22.9185,12.1453 22.7339,11.2789 22.7339,10.2726 22.7339,9.26308 22.9185,8.39672 23.2879,7.67347 23.6572,6.94715 24.1619,6.39009 24.8021,6.00231 25.4453,5.61145 26.1762,5.41602 26.9949,5.41602 27.8105,5.41602 28.5383,5.61145 29.1785,6.00231 29.8217,6.39009 30.328,6.94715 30.6973,7.67347 31.0666,8.39672 31.2513,9.26308 31.2513,10.2726z M29.8386,10.2726C29.8386,9.50314 29.714,8.85529 29.4647,8.32901 29.2185,7.79966 28.88,7.39956 28.4491,7.12873 28.0213,6.85482 27.5366,6.71786 26.9949,6.71786 26.4502,6.71786 25.9639,6.85482 25.5361,7.12873 25.1083,7.39956 24.7698,7.79966 24.5205,8.32901 24.2743,8.85529 24.1511,9.50314 24.1511,10.2726 24.1511,11.042 24.2743,11.6913 24.5205,12.2207 24.7698,12.747 25.1083,13.1471 25.5361,13.421 25.9639,13.6918 26.4502,13.8272 26.9949,13.8272 27.5366,13.8272 28.0213,13.6918 28.4491,13.421 28.88,13.1471 29.2185,12.747 29.4647,12.2207 29.714,11.6913 29.8386,11.042 29.8386,10.2726z" />
<GeometryDrawing Brush="#FF6C707E" Geometry="F1 M53,20z M0,0z M33.0298,14.9998L33.0298,5.54528 38.8927,5.54528 38.8927,6.77326 34.4563,6.77326 34.4563,9.65394 38.4726,9.65394 38.4726,10.8773 34.4563,10.8773 34.4563,14.9998 33.0298,14.9998z" />
<GeometryDrawing Brush="#FF6C707E" Geometry="F1 M53,20z M0,0z M40.647,14.9998L40.647,5.54528 46.5099,5.54528 46.5099,6.77326 42.0735,6.77326 42.0735,9.65394 46.0898,9.65394 46.0898,10.8773 42.0735,10.8773 42.0735,14.9998 40.647,14.9998z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</UserControl.Resources>
<Grid>
<Border Margin="8" Background="#f4f4f5" BorderBrush="#3b82f6" BorderThickness="2" CornerRadius="6">
<Border.Effect>
<DropShadowEffect BlurRadius="5" Opacity="0.2" />
</Border.Effect>
<Grid>
<modern:SimpleStackPanel Spacing="4" Margin="8,0" Height="40" VerticalAlignment="Top" Orientation="Horizontal">
<Border x:Name="PenTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="69"
CornerRadius="6" MouseDown="PenTabButton_MouseDown">
<Grid>
<modern:SimpleStackPanel
x:Name="PenTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H17 V0 H0 Z">
<GeometryDrawing x:Name="PenTabButtonIcon" Brush="#2563eb" Geometry="F1 M17,16z M0,0z M11,1L9,3 10.5,3C10.6326,3.00002,10.7598,3.05272,10.8535,3.14648L12.8379,5.13086C12.9317,5.22462,12.9844,5.35177,12.9844,5.48438L12.9844,7.07422 15.0586,5 15.0586,3.05859 13,1 11,1z M8,4L1,11 1,15 5.05859,15 11.9844,8.07422 11.9844,5.69141 10.293,4 8,4z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="PenTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="软笔" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
<Border x:Name="HighlighterTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="69"
CornerRadius="6" MouseDown="PenTabButton_MouseDown">
<Grid>
<modern:SimpleStackPanel
x:Name="HighlighterTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing x:Name="HighlighterTabButtonIcon" Brush="#2563eb" Geometry="F1 M16,16z M0,0z M9.51569,2.48132L3.0113,8.98571 3.0113,11.9877 0.00927734,14.9898 4.01198,14.9898 5.01265,13.9891 8.01468,13.9891 14.5191,7.4847C18.5218,3.482,13.5184,-1.52138,9.51569,2.48132z M4.01198,9.98639L7.01401,12.9884 5.01265,12.9884 4.01198,11.9877 4.01198,9.98639z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="HighlighterTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="荧光" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
<Border x:Name="LaserPenTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="69"
CornerRadius="6" MouseDown="PenTabButton_MouseDown">
<Grid>
<modern:SimpleStackPanel
x:Name="LaserPenTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing x:Name="LaserPenTabButtonIcon" Brush="#2563eb" Geometry="F1 M16,16z M0,0z M5.97371,1L3.96258,3.16821 1.12402,2.65676 2.46477,5.33641 1.12402,8.0179 3.96258,7.50645 5.97371,9.67465 6.38833,6.67716 8.97122,5.33641 6.38833,3.9975 5.97371,1z M8.32092,7.5101C8.13488,7.51015 7.95306,7.56569 7.79874,7.6696 7.64442,7.77352 7.52459,7.9211 7.45458,8.09347 7.38457,8.26585 7.36757,8.45519 7.40573,8.63728 7.44389,8.81937 7.53548,8.98594 7.66881,9.1157L13.2656,14.7125C13.3518,14.8022 13.455,14.8739 13.5692,14.9233 13.6834,14.9726 13.8064,14.9987 13.9308,15 14.0552,15.0012 14.1786,14.9776 14.2938,14.9306 14.409,14.8836 14.5137,14.814 14.6016,14.7261 14.6896,14.6381 14.7592,14.5334 14.8062,14.4182 14.8532,14.303 14.8768,14.1796 14.8755,14.0552 14.8743,13.9308 14.8482,13.8079 14.7989,13.6936 14.7495,13.5794 14.6778,13.4762 14.5881,13.39L8.9931,7.79323C8.90573,7.70341 8.80121,7.63207 8.68574,7.58344 8.57027,7.5348 8.44622,7.50986 8.32092,7.5101z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="LaserPenTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="激光" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
</modern:SimpleStackPanel>
<Border Name="CloseButtonBorder" MouseDown="CloseButtonBorder_MouseDown" MouseUp="CloseButtonBorder_MouseUp" MouseLeave="CloseButtonBorder_MouseLeave"
Height="34" Width="34" CornerRadius="6" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,6,8,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#dc2626" Geometry="F0 M24,24z M0,0z M18.7071,6.70711C19.0976,6.31658 19.0976,5.68342 18.7071,5.29289 18.3166,4.90237 17.6834,4.90237 17.2929,5.29289L12,10.5858 6.70711,5.29289C6.31658,4.90237 5.68342,4.90237 5.29289,5.29289 4.90237,5.68342 4.90237,6.31658 5.29289,6.70711L10.5858,12 5.29289,17.2929C4.90237,17.6834 4.90237,18.3166 5.29289,18.7071 5.68342,19.0976 6.31658,19.0976 6.70711,18.7071L12,13.4142 17.2929,18.7071C17.6834,19.0976 18.3166,19.0976 18.7071,18.7071 19.0976,18.3166 19.0976,17.6834 18.7071,17.2929L13.4142,12 18.7071,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
<Grid Margin="0,40,0,0" modern:ThemeManager.RequestedTheme="Light">
<!--main menu-->
<Border Margin="6" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Orientation="Vertical" Spacing="6">
<Grid>
<TextBlock FontSize="18" FontWeight="Bold" VerticalAlignment="Bottom" Foreground="#27272a" Margin="16,12,10,2" Text="墨迹粗细"></TextBlock>
<TextBlock HorizontalAlignment="Right" FontSize="12" VerticalAlignment="Bottom" Foreground="#52525b" Text="12pt 非常粗" Margin="0,0,16,3"></TextBlock>
</Grid>
<Grid Margin="14,0,14,0">
<Button Padding="3" HorizontalAlignment="Left">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF000000" Geometry="F0 M24,24z M0,0z M4,12C4,11.4477,4.44772,11,5,11L19,11C19.5523,11 20,11.4477 20,12 20,12.5523 19.5523,13 19,13L5,13C4.44772,13,4,12.5523,4,12z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
<Slider x:Name="HighlighterWidthSlider" Minimum="15"
Maximum="45" Width="145" Margin="0,-3,31,-3"
FontFamily="Microsoft YaHei UI" FontSize="20" VerticalAlignment="Center"
IsSnapToTickEnabled="True" Value="20" HorizontalAlignment="Center"
TickFrequency="1" TickPlacement="None" />
<Button Padding="3" HorizontalAlignment="Right" Margin="0,0,30,0">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF000000" Geometry="F0 M24,24z M0,0z M13,5C13,4.44772 12.5523,4 12,4 11.4477,4 11,4.44772 11,5L11,11 5,11C4.44772,11 4,11.4477 4,12 4,12.5523 4.44772,13 5,13L11,13 11,19C11,19.5523 11.4477,20 12,20 12.5523,20 13,19.5523 13,19L13,13 19,13C19.5523,13 20,12.5523 20,12 20,11.4477 19.5523,11 19,11L13,11 13,5z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
<Button Padding="3" HorizontalAlignment="Right">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF000000" Geometry="F0 M24,24z M0,0z M19,6.304L19,3.99996C19,3.44768 19.4477,2.99996 20,2.99996 20.5523,2.99996 21,3.44768 21,3.99996L21,8.99996C21,9.55225,20.5523,9.99996,20,9.99996L15,9.99996C14.4477,9.99996 14,9.55225 14,8.99996 14,8.44768 14.4477,7.99996 15,7.99996L17.7723,7.99996C16.143,5.63455 13.162,4.47625 10.2568,5.2212 9.02629,5.53779 7.90511,6.18336 7.01353,7.08868 6.12187,7.99408 5.49349,9.12512 5.19579,10.3605 4.89808,11.5959 4.94228,12.889 5.32364,14.1012 5.705,15.3134 6.40914,16.3989 7.36053,17.2413 8.31193,18.0837 9.4747,18.6512 10.7241,18.883 11.9736,19.1148 13.2625,19.0021 14.4528,18.557 15.643,18.1119 16.6897,17.3512 17.4804,16.3565 18.2712,15.3618 18.7763,14.1706 18.9416,12.9106 19.0134,12.363 19.5155,11.9773 20.0631,12.0491 20.6107,12.1209 20.9964,12.6231 20.9246,13.1707 20.7121,14.7906 20.0627,16.3222 19.046,17.6011 18.0293,18.88 16.6836,19.8581 15.1533,20.4303 13.623,21.0026 11.9657,21.1475 10.3593,20.8494 8.7529,20.5514 7.25792,19.8217 6.03469,18.7386 4.81147,17.6555 3.90615,16.2599 3.41583,14.7014 2.92551,13.1429 2.86868,11.4803 3.25145,9.89195 3.63421,8.3036 4.44212,6.8494 5.58854,5.68532 6.73496,4.52123 8.17663,3.69118 9.75895,3.28417L9.75963,3.28399C13.2427,2.39068,16.8325,3.6344,19,6.304z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
</Grid>
<Line X1="0" Y1="0" X2="240" Y2="0" Margin="0,2" Name="_QuickAction_Line1" HorizontalAlignment="Center" Stroke="#a1a1aa" />
<Grid Name="_QuickAction_Grid">
<modern:ScrollViewerEx ScrollChanged="QuickActionsScrollViewer_ScrollChanged" Name="QuickActionScrollViewer" PreviewMouseWheel="QuickActionsScrollViewer_PreviewMouseWheel" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled" PanningMode="HorizontalOnly" Orientation="Horizontal" ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback">
<modern:SimpleStackPanel Margin="14,0,14,0" Orientation="Horizontal" Spacing="6" Name="QuickActionItems">
<Border Width="117" Height="96" Background="#f4f4f5" BorderBrush="#d4d4d8" CornerRadius="3" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Height="28" Width="28">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#27272a" Geometry="F1 M16,16z M0,0z M12.4565,1C12.0615,1.00001 11.6788,1.13756 11.3742,1.38903 11.0695,1.6405 10.8619,1.9902 10.7871,2.37806L4.21558,3.57272C4.05651,3.32218 3.83674,3.11586 3.57665,2.97293 3.31656,2.83 3.02459,2.7551 2.72782,2.75514 2.26051,2.75514 1.81234,2.94078 1.4819,3.27122 1.15146,3.60166 0.965821,4.04983 0.96582,4.51714 0.965884,4.8698 1.07177,5.2143 1.26978,5.50612 1.46779,5.79794 1.74882,6.02365 2.0765,6.15402L2.0765,11.6474C1.74963,11.7734 1.46858,11.9954 1.27033,12.2842 1.07208,12.573 0.965914,12.9151 0.96582,13.2654 0.965821,13.7255 1.14857,14.1667 1.47387,14.492 1.79916,14.8173 2.24036,15 2.70039,15 3.16043,15 3.60163,14.8173 3.92692,14.492 4.25222,14.1667 4.43497,13.7255 4.43497,13.2654 4.4343,13.1024 4.41064,12.9402 4.36469,12.7838L7.12253,10.487C7.39871,10.6501 7.71365,10.7359 8.03438,10.7356 8.485,10.7354 8.91898,10.5652 9.24961,10.2591L11.6098,11.4383C11.6076,11.4737 11.6064,11.5091 11.6064,11.5446 11.6064,11.7697 11.6507,11.9925 11.7368,12.2005 11.823,12.4084 11.9492,12.5974 12.1084,12.7565 12.2676,12.9157 12.4565,13.042 12.6645,13.1281 12.8724,13.2142 13.0953,13.2586 13.3204,13.2586 13.5455,13.2586 13.7684,13.2142 13.9763,13.1281 14.1843,13.042 14.3732,12.9157 14.5324,12.7565 14.6915,12.5974 14.8178,12.4084 14.9039,12.2005 14.9901,11.9925 15.0344,11.7697 15.0344,11.5446 15.0341,11.1676 14.9094,10.8012 14.6798,10.5022 14.4502,10.2032 14.1284,9.98819 13.7643,9.89055L13.197,4.22919C13.4844,4.09016 13.7268,3.87305 13.8966,3.60266 14.0663,3.33228 14.1565,3.01955 14.1568,2.70029 14.1568,2.24935 13.9777,1.81689 13.6588,1.49803 13.3399,1.17916 12.9075,1 12.4565,1z M11.0579,3.66528C11.2593,3.95732,11.5469,4.17907,11.8806,4.29946L12.4582,10.0637C12.3625,10.1194,12.2724,10.1842,12.1891,10.2573L9.81866,9.07125C9.82185,9.02962 9.82357,8.98789 9.82384,8.94613 9.82384,8.71114 9.77755,8.47844 9.68763,8.26133 9.5977,8.04423 9.4659,7.84698 9.29973,7.68082 9.13357,7.51466 8.9363,7.38285 8.7192,7.29292 8.5021,7.20299 8.26941,7.15671 8.03441,7.15671 7.79942,7.1567 7.56673,7.20299 7.34962,7.29292 7.13251,7.38284 6.93525,7.51466 6.76908,7.68082 6.60291,7.84698 6.4711,8.04423 6.38117,8.26133 6.29124,8.47844 6.24496,8.71114 6.24496,8.94613 6.24475,9.11487 6.26841,9.28279 6.31523,9.44491L3.54711,11.752C3.497,11.7237,3.44552,11.698,3.39285,11.6748L3.39285,6.14887C3.66164,6.03912 3.89914,5.86466 4.08423,5.64099 4.26933,5.41732 4.39629,5.15137 4.45382,4.8668L11.0579,3.66528z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#27272a">墨迹纠正</TextBlock>
<Button Name="InkRecognitionToggleSwitchButton" Click="InkRecognitionToggleSwitchButton_Clicked" Style="{x:Null}" ClipToBounds="False" BorderBrush="Transparent" BorderThickness="0" Padding="0" Background="Transparent" HorizontalAlignment="Center" Margin="0,6,0,0">
<Image Name="InkRecognitionToggleSwitchImage" Height="20" Source="{StaticResource SwitchOnImage}" />
</Button>
</modern:SimpleStackPanel>
<Border Name="InkRecognitionMoreButton" MouseDown="InkRecognitionMoreButton_MouseDown" Height="26" Width="26" CornerRadius="3" Background="#2227272a" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,4,4,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F1 M24,24z M0,0z M9,6.00024C9,5.14824,9.986,4.70324,10.623,5.21724L10.707,5.29324 16.707,11.2932C16.8792,11.4654 16.9826,11.6945 16.9979,11.9376 17.0132,12.1806 16.9393,12.4208 16.79,12.6132L16.707,12.7072 10.707,18.7072 10.613,18.7902 10.536,18.8442 10.44,18.8982 10.404,18.9152 10.337,18.9422 10.229,18.9742 10.176,18.9842 10.116,18.9942 10.059,18.9982 10,19.0002 9.941,18.9982 9.883,18.9932 9.823,18.9842 9.771,18.9742 9.663,18.9422 9.596,18.9152 9.464,18.8452 9.374,18.7802 9.293,18.7072 9.21,18.6132 9.156,18.5362 9.102,18.4402 9.085,18.4042 9.058,18.3372 9.026,18.2292 9.016,18.1762 9.006,18.1162 9.002,18.0592 9,6.00024z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
</Grid>
</Border>
<Border Width="117" Height="96" Background="#f4f4f5" BorderBrush="#d4d4d8" CornerRadius="3" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Height="28" Width="28">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#27272a" Geometry="F0 M16,16z M0,0z M4.80227,1.875C6.00275,1.15471 7.13561,1 7.13561,1 4.41946,3.625 4.07311,7.125 4.51061,11.5 2.76061,11.9375 3.63561,14.125 3.63561,14.125L2.76061,15C2.76061,15 2.37775,14.125 2.29576,12.375 2.29576,12.375 0.709825,11.582 1.01061,8 1.01061,6.6694 1.8856,3.625 4.80227,1.875z M8.01047,7.61719C8.01047,7.34773,8.40072,7.125,8.88547,7.125L12.3855,7.125C12.8702,7.125,13.2605,7.34773,13.2605,7.61719L13.2605,8.38281C13.2605,8.65227,12.8702,8.875,12.3855,8.875L14.1355,8.875C14.6181,8.875,15.1274,9.33921,15.0105,9.88672L14.1355,13.9883C14.0185,14.5358,13.7431,15,13.2605,15L8.01047,15C7.52783,15,7.2524,14.5358,7.13547,13.9883L6.28781,9.88672C6.17087,9.33921,6.65281,8.875,7.13547,8.875L8.88547,8.875C8.40072,8.875,8.01047,8.65227,8.01047,8.38281L8.01047,7.61719z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#27272a">模拟笔锋</TextBlock>
<Button Name="SimulatePressureToggleSwitchButton" Click="SimulatePressureToggleSwitchButton_Clicked" Style="{x:Null}" ClipToBounds="False" BorderBrush="Transparent" BorderThickness="0" Padding="0" Background="Transparent" HorizontalAlignment="Center" Margin="0,6,0,0">
<Image Name="SimulatePressureToggleSwitchImage" Height="20" Source="{StaticResource SwitchOnImage}" />
</Button>
</modern:SimpleStackPanel>
<Border Name="SimulatePressureMoreButton" MouseDown="SimulatePressureMoreButton_MouseDown" Height="26" Width="26" CornerRadius="3" Background="#2227272a" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,4,4,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F1 M24,24z M0,0z M9,6.00024C9,5.14824,9.986,4.70324,10.623,5.21724L10.707,5.29324 16.707,11.2932C16.8792,11.4654 16.9826,11.6945 16.9979,11.9376 17.0132,12.1806 16.9393,12.4208 16.79,12.6132L16.707,12.7072 10.707,18.7072 10.613,18.7902 10.536,18.8442 10.44,18.8982 10.404,18.9152 10.337,18.9422 10.229,18.9742 10.176,18.9842 10.116,18.9942 10.059,18.9982 10,19.0002 9.941,18.9982 9.883,18.9932 9.823,18.9842 9.771,18.9742 9.663,18.9422 9.596,18.9152 9.464,18.8452 9.374,18.7802 9.293,18.7072 9.21,18.6132 9.156,18.5362 9.102,18.4402 9.085,18.4042 9.058,18.3372 9.026,18.2292 9.016,18.1762 9.006,18.1162 9.002,18.0592 9,6.00024z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
</Grid>
</Border>
<Border Width="117" Height="96" Background="#f4f4f5" BorderBrush="#d4d4d8" CornerRadius="3" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Height="28" Width="28">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V17 H17 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M17,17z M0,0z M12.8619,1.53958C13.1164,1.27815 13.4627,1.12597 13.8273,1.11539 15.1066,1.07854 15.7644,2.63232 14.8476,3.52524L9.41539,8.9282C8.97043,8.07844,8.27949,7.3875,7.42973,6.94254L12.8619,1.53958z M5.01998,15.112C7.08804,15.1212 8.76457,13.4355 8.76457,11.3674 8.76457,9.29935 7.08806,7.62284 5.01998,7.62284 2.9519,7.62284 1.27539,9.29935 1.27539,11.3674L1.27539,15.112 5.01998,15.112z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#27272a">圆形笔尖</TextBlock>
<Button Name="StylusTipShapeButton" Click="SimulatePressureToggleSwitchButton_Clicked" Style="{x:Null}" ClipToBounds="False" BorderBrush="Transparent" BorderThickness="0" Padding="0" Background="Transparent" HorizontalAlignment="Center" Margin="0,6,0,0">
<Image Name="StylusTipShapeToggleSwitchImage" Height="20" Source="{StaticResource SwitchOnImage}" />
</Button>
</modern:SimpleStackPanel>
</Grid>
</Border>
<Border Width="117" Height="96" Background="#f4f4f5" BorderBrush="#d4d4d8" CornerRadius="3" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Height="28" Width="28">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F1 M16,16z M0,0z M7.08831,3.6385C7.00086,3.6421 6.91445,3.65879 6.83196,3.68802 6.77659,3.70768 6.72335,3.73287 6.67303,3.76319 6.64829,3.7785 6.62434,3.79502 6.60125,3.81271 6.53072,3.86518 6.4685,3.92798 6.41668,3.99899 6.34819,4.09373 6.29938,4.20123 6.27313,4.31515 6.26659,4.34337 6.26146,4.3719 6.25775,4.40064 6.25359,4.43354 6.25131,4.46666 6.25091,4.49982L6.25091,8.87478 6.25091,11.8347 4.01729,10.717C3.82176,10.6189 3.59654,10.5975 3.38603,10.6571 3.17552,10.7168 2.99499,10.8531 2.88003,11.0393 2.76507,11.2255 2.72403,11.4479 2.76498,11.6629 2.80594,11.8778 2.92592,12.0696 3.10129,12.2004L6.58245,14.81 6.60125,14.8254C6.60969,14.8313 6.61824,14.8369 6.62688,14.8425 6.64029,14.852 6.65397,14.8611 6.66789,14.8698 6.67803,14.8757 6.68829,14.8814 6.69866,14.8868 6.71159,14.894 6.72469,14.9008 6.73796,14.9073 6.75369,14.9152 6.76965,14.9226 6.78582,14.9295 6.79655,14.9343 6.80737,14.9389 6.81829,14.9432 6.8363,14.9501 6.85454,14.9563 6.87297,14.962 6.88148,14.9645 6.89003,14.9668 6.89861,14.969 6.91333,14.9728 6.92815,14.9762 6.94304,14.9792 6.96003,14.9832 6.97712,14.9866 6.99431,14.9895 7.0017,14.9907 7.00911,14.9919 7.01653,14.993 7.04037,14.9957 7.06431,14.9975 7.0883,14.9982 7.10082,14.999 7.11336,14.9995 7.1259,14.9997L11.5009,14.9997C11.5009,14.9997 11.9023,15.0118 12.3297,14.7981 12.7572,14.5843 13.2508,13.9789 13.2508,13.2497L13.2508,9.74977C13.2509,9.55451 13.1857,9.36483 13.0655,9.21092 12.9454,9.05702 12.7772,8.94772 12.5878,8.90041L9.0878,8.02542C9.01847,8.00826,8.9473,7.99965,8.87589,7.99979L8.00089,7.99979 8.00089,4.49982C7.99966,4.41215 7.98526,4.32516 7.95817,4.24177 7.93084,4.15825 7.89109,4.07932 7.84025,4.00764 7.82373,3.984 7.80604,3.9612 7.78727,3.93931 7.73013,3.87272 7.6633,3.81511 7.58903,3.7684 7.56409,3.75345 7.53843,3.73976 7.51213,3.72737 7.48597,3.71407 7.45916,3.7021 7.4318,3.69149 7.40433,3.68156 7.37639,3.67299 7.34807,3.66585 7.31991,3.65816 7.29139,3.65188 7.26261,3.64704 7.20495,3.63832 7.14656,3.6356 7.08831,3.6385z" />
<GeometryDrawing Geometry="F1 M16,16z M0,0z M7.12594,1C5.20333,1 3.62598,2.57736 3.62598,4.49996 3.62598,5.78324 4.33688,6.90019 5.37596,7.50946L5.37596,4.49996C5.37596,3.54561 6.17159,2.74998 7.12594,2.74998 8.08029,2.74998 8.87592,3.54561 8.87592,4.49996L8.87592,7.12494C8.94734,7.1248,9.01851,7.13341,9.08784,7.15057L9.31171,7.20702C10.1054,6.56354 10.6259,5.59334 10.6259,4.49996 10.6259,2.57736 9.04855,1 7.12594,1z">
<GeometryDrawing.Brush>
<SolidColorBrush Color="#18181b" Opacity="0.5" />
</GeometryDrawing.Brush>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Foreground="#27272a">手指模式</TextBlock>
<Button Name="FingerModeButton" Click="SimulatePressureToggleSwitchButton_Clicked" Style="{x:Null}" ClipToBounds="False" BorderBrush="Transparent" BorderThickness="0" Padding="0" Background="Transparent" HorizontalAlignment="Center" Margin="0,6,0,0">
<Image Name="FingerModeToggleSwitchImage" Height="20" Source="{StaticResource SwitchOnImage}" />
</Button>
</modern:SimpleStackPanel>
</Grid>
</Border>
</modern:SimpleStackPanel>
</modern:ScrollViewerEx>
<Border Width="14" HorizontalAlignment="Left">
<Border.Background>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#fafafa" Offset="0"/>
<GradientStop Color="#00ffffff" Offset="0.5"/>
<GradientStop Color="#00ffffff" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
</Border>
<Border Width="14" HorizontalAlignment="Right">
<Border.Background>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#fafafa" Offset="1"/>
<GradientStop Color="#00ffffff" Offset="0.5"/>
<GradientStop Color="#00ffffff" Offset="0"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
</Border>
</Grid>
<Grid Margin="14,3,14,0" Height="5" Name="_QuickAction_Dots">
<modern:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="3">
<Border Height="5" Width="5" Name="QuickActionDot1" CornerRadius="2.5" Background="#d4d4d8"/>
<Border Height="5" Width="5" Name="QuickActionDot2" CornerRadius="2.5" Background="#27272a"/>
</modern:SimpleStackPanel>
</Grid>
<Line Name="_QuickAction_Line2" X1="0" Y1="0" X2="240" Y2="0" Margin="0,2" HorizontalAlignment="Center" Stroke="#a1a1aa" />
<Grid>
<Grid Margin="10,0,10,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Black" Grid.Row="0" Grid.Column="0" Margin="2" CornerRadius="3" Background="#09090b" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="White" Grid.Row="0" Grid.Column="1" Margin="2" CornerRadius="3" Background="#fafafa" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Red" Grid.Row="0" Grid.Column="2" Margin="2" CornerRadius="3" Background="#dc2626" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Orange" Grid.Row="0" Grid.Column="3" Margin="2" CornerRadius="3" Background="#ea580c" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Yellow" Grid.Row="0" Grid.Column="4" Margin="2" CornerRadius="3" Background="#facc15" BorderBrush="#5518181b" BorderThickness="1" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Lime" Grid.Row="1" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#65a30d" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Green" Grid.Row="1" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#16a34a" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Teal" Grid.Row="1" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#0d9488" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Cyan" Grid.Row="1" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#0284c7" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Blue" Grid.Row="1" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#2563eb" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Indigo" Grid.Row="2" Grid.Column="0" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#4f46e5" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Purple" Grid.Row="2" Grid.Column="1" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#7c3aed" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Fuchsia" Grid.Row="2" Grid.Column="2" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#c026d3" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Pink" Grid.Row="2" Grid.Column="3" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#db2777" Width="42" Height="36">
</Border>
<Border MouseDown="ColorButton_MouseDown" MouseUp="ColorButton_MouseUp" MouseLeave="ColorButton_MouseLeave" Name="Rose" Grid.Row="2" Grid.Column="4" Margin="2,6,2,2" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1" Background="#e11d48" Width="42" Height="36">
</Border>
</Grid>
</Grid>
<Grid Margin="12,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Click="RandomColorButton_Clicked" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M21.9176,16.6399C21.8676,16.5199,21.7976,16.4099,21.6976,16.3099L18.6976,13.3099C18.3076,12.9199 17.6776,12.9199 17.2876,13.3099 16.8976,13.6999 16.8976,14.3299 17.2876,14.7199L18.5776,16.0099 15.9876,16.0099C14.9276,16.0099 13.9076,15.5899 13.1576,14.8399 12.4076,14.0899 11.9876,13.0699 11.9876,12.0099 11.9876,10.9499 12.4076,9.92995 13.1576,9.17995 13.9076,8.42995 14.9276,8.00995 15.9876,8.00995L18.5776,8.00995 17.2876,9.29995C16.8976,9.68995 16.8976,10.3199 17.2876,10.7099 17.6776,11.0999 18.3076,11.0999 18.6976,10.7099L21.6976,7.70995C21.7876,7.61995 21.8676,7.50995 21.9176,7.38995 22.0176,7.14995 22.0176,6.86995 21.9176,6.62995 21.8676,6.50995 21.7976,6.39995 21.6976,6.29995L18.6976,3.29995C18.3076,2.90995 17.6776,2.90995 17.2876,3.29995 16.8976,3.68995 16.8976,4.31995 17.2876,4.70995L18.5776,5.99995 15.9876,5.99995C14.3976,5.99995 12.8676,6.62995 11.7476,7.75995 11.4576,8.04995 11.2076,8.35995 10.9876,8.68995 10.7676,8.35995 10.5176,8.04995 10.2276,7.75995 9.09756,6.62995 7.57756,5.99995 5.98756,5.99995L2.99756,5.99995C2.44756,5.99995 1.99756,6.44995 1.99756,6.99995 1.99756,7.54995 2.44756,7.99995 2.99756,7.99995L5.99756,7.99995C7.05756,7.99995 8.07756,8.41995 8.82756,9.16995 9.57756,9.91995 9.99756,10.9399 9.99756,11.9999 9.99756,13.0599 9.57756,14.0799 8.82756,14.8299 8.07756,15.5799 7.05756,15.9999 5.99756,15.9999L2.99756,15.9999C2.44756,15.9999 1.99756,16.4499 1.99756,16.9999 1.99756,17.5499 2.44756,17.9999 2.99756,17.9999L5.99756,17.9999C7.58756,17.9999 9.11756,17.3699 10.2376,16.2399 10.5276,15.9499 10.7776,15.6399 10.9976,15.3099 11.2176,15.6399 11.4676,15.9499 11.7576,16.2399 12.8876,17.3699 14.4076,17.9999 15.9976,17.9999L18.5876,17.9999 17.2976,19.2899C16.9076,19.6799 16.9076,20.3099 17.2976,20.6999 17.6876,21.0899 18.3176,21.0899 18.7076,20.6999L21.7076,17.6999C21.7976,17.6099 21.8776,17.4999 21.9276,17.3699 22.0276,17.1299 22.0276,16.8499 21.9276,16.6099L21.9176,16.6399z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="随机" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Name="CustomColorButton" Click="CustomColorButton_Clicked" ClipToBounds="False" Grid.Column="1" HorizontalAlignment="Stretch" Margin="3,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Border Name="CustomColorButtonColorBorder" VerticalAlignment="Center" Width="19" Height="19" Visibility="Collapsed" CornerRadius="3" BorderBrush="#5518181b" BorderThickness="1">
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Name="CustomColorButtonColorBorderCheckIcon" Height="16" Width="16" Source="{StaticResource CheckedDarkIcon}" />
</Border>
<Image Name="CustomColorButtonIcon" Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M6.34315,6.34315C7.84344,4.84285 9.87827,4 12,4 16.5317,4 20,7.24178 20,11 20,11.7543 19.6636,12.5066 19.0177,13.0805 18.3676,13.6582 17.463,14 16.5,14L14.0073,14C13.3411,13.9912 12.6909,14.2044 12.1593,14.6061 11.6253,15.0096 11.2415,15.5801 11.0691,16.2268 10.8966,16.8735 10.9454,17.5592 11.2076,18.175 11.447,18.7374 11.8519,19.2118 12.3664,19.5366 12.3885,19.5691 12.4042,19.6058 12.4122,19.6447 12.4249,19.7061 12.418,19.77 12.3926,19.8272 12.3671,19.8845 12.3243,19.9324 12.2702,19.9641 12.2162,19.9959 12.1535,20.0099 12.0911,20.0042 12.0608,20.0014 12.0304,20 12,20 9.87827,20 7.84344,19.1571 6.34315,17.6569 4.84285,16.1566 4,14.1217 4,12 4,9.87827 4.84285,7.84344 6.34315,6.34315z M12,2C9.34784,2 6.8043,3.05357 4.92893,4.92893 3.05357,6.8043 2,9.34784 2,12 2,14.6522 3.05357,17.1957 4.92893,19.0711 6.79478,20.9369 9.32205,21.9893 11.9596,21.9999 12.4214,22.0319 12.8826,21.9237 13.2825,21.6891 13.697,21.4458 14.025,21.0788 14.2202,20.6395 14.4154,20.2003 14.4681,19.7109 14.3709,19.2402 14.2737,18.7695 14.0314,18.341 13.6781,18.0151 13.6192,17.9607 13.554,17.9137 13.4839,17.8749 13.2886,17.7669 13.1351,17.5968 13.0477,17.3915 12.9603,17.1862 12.9441,16.9576 13.0015,16.7421 13.059,16.5265 13.1869,16.3364 13.3649,16.2019 13.543,16.0674 13.7608,15.9963 13.9839,15.9999L14,16 16.5,16C17.923,16 19.3084,15.4978 20.3463,14.5755 21.3884,13.6494 22,12.3657 22,11 22,5.92222 17.4083,2 12,2z M8.5,8.5C7.96957,8.5 7.46086,8.71071 7.08579,9.08579 6.71071,9.46086 6.5,9.96957 6.5,10.5 6.5,11.0304 6.71071,11.5391 7.08579,11.9142 7.46086,12.2893 7.96957,12.5 8.5,12.5 9.03043,12.5 9.53914,12.2893 9.91421,11.9142 10.2893,11.5391 10.5,11.0304 10.5,10.5 10.5,9.96957 10.2893,9.46086 9.91421,9.08579 9.53914,8.71071 9.03043,8.5 8.5,8.5z M11.0858,6.08579C11.4609,5.71071 11.9696,5.5 12.5,5.5 13.0304,5.5 13.5391,5.71071 13.9142,6.08579 14.2893,6.46086 14.5,6.96957 14.5,7.5 14.5,8.03043 14.2893,8.53914 13.9142,8.91421 13.5391,9.28929 13.0304,9.5 12.5,9.5 11.9696,9.5 11.4609,9.28929 11.0858,8.91421 10.7107,8.53914 10.5,8.03043 10.5,7.5 10.5,6.96957 10.7107,6.46086 11.0858,6.08579z M16.5,8.5C15.9696,8.5 15.4609,8.71071 15.0858,9.08579 14.7107,9.46086 14.5,9.96957 14.5,10.5 14.5,11.0304 14.7107,11.5391 15.0858,11.9142 15.4609,12.2893 15.9696,12.5 16.5,12.5 17.0304,12.5 17.5391,12.2893 17.9142,11.9142 18.2893,11.5391 18.5,11.0304 18.5,10.5 18.5,9.96957 18.2893,9.46086 17.9142,9.08579 17.5391,8.71071 17.0304,8.5 16.5,8.5z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="自定" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Name="ColorModeChangeButton" Click="ColorModeChangeButton_Clicked" Grid.Column="2" HorizontalAlignment="Stretch" Margin="3,0,0,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M8.17317,2.7612C9.38642,2.25866 10.6868,2 12,2 13.3132,2 14.6136,2.25866 15.8268,2.7612 17.0401,3.26375 18.1425,4.00035 19.0711,4.92893 19.9997,5.85752 20.7362,6.95991 21.2388,8.17317 21.7413,9.38642 22,10.6868 22,12 22,13.3132 21.7413,14.6136 21.2388,15.8268 20.7362,17.0401 19.9997,18.1425 19.0711,19.0711 18.1425,19.9997 17.0401,20.7362 15.8268,21.2388 14.6136,21.7413 13.3132,22 12,22 10.6868,22 9.38642,21.7413 8.17317,21.2388 6.95991,20.7362 5.85752,19.9997 4.92893,19.0711 4.00035,18.1425 3.26375,17.0401 2.7612,15.8268 2.25866,14.6136 2,13.3132 2,12 2,10.6868 2.25866,9.38642 2.7612,8.17317 3.26375,6.95991 4.00035,5.85752 4.92893,4.92893 5.85752,4.00035 6.95991,3.26375 8.17317,2.7612z M8.93853,4.60896C9.59962,4.33513,10.293,4.15182,11,4.06275L11,8.99928 11,9.00067 11,14.2994 11,14.3007 11,19.5993C11,19.5998,11,19.6002,11,19.6007L11,19.9373C10.293,19.8482 9.59962,19.6649 8.93853,19.391 7.96793,18.989 7.08601,18.3997 6.34315,17.6569 5.60028,16.914 5.011,16.0321 4.60896,15.0615 4.20693,14.0909 4,13.0506 4,12 4,10.9494 4.20693,9.90914 4.60896,8.93853 5.011,7.96793 5.60028,7.08601 6.34315,6.34315 7.08601,5.60028 7.96793,5.011 8.93853,4.60896z M13.0886,19.9256C13.7649,19.8327 14.428,19.6534 15.0615,19.391 16.0321,18.989 16.914,18.3997 17.6569,17.6569 18.3997,16.914 18.989,16.0321 19.391,15.0615 19.6534,14.428 19.8327,13.7649 19.9256,13.0886L13.0886,19.9256z M19.8293,10.3564C19.7277,9.8724 19.5812,9.39767 19.391,8.93853 19.3316,8.79496 19.268,8.65334 19.2005,8.51381L13,14.7143 13,17.1858 19.8293,10.3564z M13,11.8858L18.0824,6.80343C17.9468,6.64475 17.8049,6.49119 17.6569,6.34315 17.391,6.07727 17.1073,5.83107 16.8081,5.60609L13,9.41419 13,11.8858z M15.0014,4.58437C14.3584,4.32413,13.6856,4.14912,13,4.06275L13,6.58576 15.0014,4.58437z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="亮色" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
</Grid>
</modern:SimpleStackPanel>
</Grid>
</Border>
<!--custom color panel-->
<Border Name="CustomColorPanel" Visibility="Collapsed" Margin="6" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Orientation="Vertical" Spacing="6">
<TextBlock FontSize="18" FontWeight="Bold" VerticalAlignment="Bottom" Foreground="#27272a" Margin="16,12,10,2" Text="自定义颜色"></TextBlock>
<Grid>
<colorPicker:SquarePicker Name="CustomColorPicker" ColorChanged="CustomColorPicker_ColorChanged" HorizontalAlignment="Center" Width="242" Height="242" />
</Grid>
<Grid Margin="12,2,12,0">
<Border Name="CustomColorHexBorder" HorizontalAlignment="Left" Width="32" Height="32" CornerRadius="3" BorderBrush="#6618181b" BorderThickness="1" />
<TextBox Name="CustomColorHexTextBox" Margin="36,0,0,0" HorizontalAlignment="Stretch" Text="#000000"></TextBox>
</Grid>
<Button Click="BackToPaletteButton_Clicked" HorizontalAlignment="Stretch" Margin="12,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F1 M24,24z M0,0z M12.7071,5.70711C13.0976,5.31658 13.0976,4.68342 12.7071,4.29289 12.3166,3.90237 11.6834,3.90237 11.2929,4.29289L4.29289,11.2929C3.90237,11.6834,3.90237,12.3166,4.29289,12.7071L11.2929,19.7071C11.6834,20.0976 12.3166,20.0976 12.7071,19.7071 13.0976,19.3166 13.0976,18.6834 12.7071,18.2929L7.41421,13 19,13C19.5523,13 20,12.5523 20,12 20,11.4477 19.5523,11 19,11L7.41421,11 12.7071,5.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="返回调色盘" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
</modern:SimpleStackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
</UserControl>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,233 @@
<Window x:Class="Ink_Canvas.FloatingToolBarV2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas"
xmlns:popups="clr-namespace:Ink_Canvas.Popups"
Topmost="True" Loaded="FloatingBarV2_Loaded"
mc:Ignorable="d" WindowStyle="None" Background="Transparent" AllowsTransparency="True" ResizeMode="NoResize"
Title="FloatingToolBarV2">
<Window.Resources>
<DrawingImage x:Key="CursorIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M5.19409,16.3124C5.46422,18.0658 5.69121,19.539 5.8351,20.4621 5.9631,21.2477 6.80568,21.3359 7.22902,20.5643 7.93608,19.3044 9.20443,17.1009 10.0921,15.5636L14.9921,22.5615C15.1915,22.8462,15.5839,22.9154,15.8687,22.716L17.9309,21.272C18.2157,21.0727,18.2848,20.6802,18.0854,20.3955L13.5037,13.8522C15.6284,13.8519 18.6266,13.8518 20.2609,13.8524 21.1847,13.8201 21.258,12.9461 20.5777,12.4184 16.9666,9.91811 8.45126,4.12632 4.34164,1.42431 3.63839,0.928666 2.78717,1.12985 3.00557,2.27077 3.59731,5.94841 4.52718,11.9839 5.19409,16.3124z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="PenIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M20.4786,1.42438C19.9985,1.23743 19.4847,1.15194 18.9698,1.17319 18.4549,1.19444 17.9499,1.32197 17.4869,1.54789 17.0368,1.76752 16.6358,2.07554 16.3083,2.45361L3.85516,14.9067 9.08243,20.134 21.5311,7.68529C21.9113,7.36382 22.223,6.96912 22.447,6.52438 22.6786,6.06462 22.8113,5.56167 22.8365,5.04763 22.8616,4.5336 22.7787,4.02012 22.593,3.54002 22.4073,3.05994 22.1232,2.62403 21.759,2.25988 21.3949,1.89574 20.9587,1.61132 20.4786,1.42438z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M7.28056,21.1605L2.8286,16.7086 1.15912,22.83 7.28056,21.1605z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="EraserIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M15.6314,20.7262L22.7921,13.5655C24.3494,12.141,24.2819,9.81776,22.8105,8.34633L16.7793,2.31508C15.3547,0.757753,13.0315,0.825236,11.5601,2.29666L4.38099,9.47574 15.6314,20.7262z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M14.2172,22.1404L2.96677,10.89 1.20761,12.6491C-0.34971,14.0737,-0.281711,16.3974,1.18971,17.8688L6.15089,22.83 13.5276,22.83 14.2172,22.1404z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="TrashBinIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#e01b24" Geometry="F0 M24,24z M0,0z M8.82358,1.16992C8.5646,1.16992,8.33468,1.33565,8.25279,1.58133L7.5877,3.57659 1.77159,3.57659C1.4393,3.57659,1.16992,3.84597,1.16992,4.17826L1.16992,5.38159C1.16992,5.71388,1.4393,5.98326,1.77159,5.98326L22.2283,5.98326C22.5605,5.98326,22.8299,5.71388,22.8299,5.38159L22.8299,4.17826C22.8299,3.84597,22.5605,3.57659,22.2283,3.57659L16.4122,3.57659 15.7471,1.58133C15.6652,1.33565,15.4352,1.16992,15.1762,1.16992L8.82358,1.16992z M3.57659,7.78826L20.4233,7.78826 19.3085,21.7225C19.2584,22.3479,18.7364,22.8299,18.109,22.8299L5.89083,22.8299C5.26346,22.8299,4.74137,22.3479,4.69133,21.7225L3.57659,7.78826z M8.99159,11.9999C8.6593,11.9999,8.38992,12.2693,8.38992,12.6016L8.38992,17.4149C8.38992,17.7472,8.6593,18.0166,8.99159,18.0166L9.59326,18.0166C9.9255,18.0166,10.1949,17.7472,10.1949,17.4149L10.1949,12.6016C10.1949,12.2693,9.9255,11.9999,9.59326,11.9999L8.99159,11.9999z M13.8049,12.6016C13.8049,12.2693,14.0743,11.9999,14.4066,11.9999L15.0083,11.9999C15.3405,11.9999,15.6099,12.2693,15.6099,12.6016L15.6099,17.4149C15.6099,17.7472,15.3405,18.0166,15.0083,18.0166L14.4066,18.0166C14.0743,18.0166,13.8049,17.7472,13.8049,17.4149L13.8049,12.6016z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ShapesIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M17.8613,10.7596L12.0077,1.16992 6.14056,10.7596 17.8613,10.7596z" />
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M10.9354,13.2402L1.3457,13.2402 1.3457,22.8299 10.9354,22.8299 10.9354,13.2402z" />
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M17.8613,13.2402C15.2132,13.2402 13.0665,15.3869 13.0665,18.0351 13.0665,20.6832 15.2132,22.8299 17.8613,22.8299 20.5094,22.8299 22.6562,20.6832 22.6562,18.0351 22.6562,15.3869 20.5094,13.2402 17.8613,13.2402z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="SelectIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M2.12162,2.12162C2.73093,1.51232,3.55732,1.17001,4.41901,1.17001L5.50201,1.17001 5.50201,3.33601 4.41901,3.33601C4.13178,3.33601 3.85632,3.45011 3.65321,3.65321 3.45011,3.85632 3.33601,4.13178 3.33601,4.41901L3.33601,5.50201 1.17001,5.50201 1.17001,4.41901C1.17001,3.55732,1.51232,2.73093,2.12162,2.12162z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M18.498,1.17001L19.581,1.17001C20.4427,1.17001 21.2691,1.51232 21.8784,2.12162 22.4877,2.73093 22.83,3.55732 22.83,4.41901L22.83,5.50201 20.664,5.50201 20.664,4.41901C20.664,4.13178 20.5499,3.85632 20.3468,3.65321 20.1437,3.45011 19.8682,3.33601 19.581,3.33601L18.498,3.33601 18.498,1.17001z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M3.33601,19.581L3.33601,18.498 1.17001,18.498 1.17001,19.581C1.17001,20.4427 1.51232,21.2691 2.12162,21.8784 2.73093,22.4877 3.55732,22.83 4.41901,22.83L5.50201,22.83 5.50201,20.664 4.41901,20.664C4.13178,20.664 3.85632,20.5499 3.65321,20.3468 3.45011,20.1437 3.33601,19.8682 3.33601,19.581z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M7.66801,1.17001L10.917,1.17001 10.917,3.33601 7.66801,3.33601 7.66801,1.17001z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M12,20.664L7.66801,20.664 7.66801,22.83 12,22.83 12,20.664z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M13.083,1.17001L16.332,1.17001 16.332,3.33601 13.083,3.33601 13.083,1.17001z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M3.33601,10.917L3.33601,7.66801 1.17001,7.66801 1.17001,10.917 3.33601,10.917z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M22.83,7.66801L22.83,12 20.664,12 20.664,7.66801 22.83,7.66801z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M3.33601,16.332L3.33601,13.083 1.17001,13.083 1.17001,16.332 3.33601,16.332z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M10.7469,10.747L22.83,15.781 18.4517,17.2681 22.2785,21.0949 21.0949,22.2785 17.2681,18.4517 15.781,22.83 10.7469,10.747z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="UndoIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M8.71408,16.8493L0.874451,9.00964 8.71408,1.17001 8.71408,7.42358 15.7239,7.42358C16.7074,7.42358 17.6791,7.62744 18.583,8.02124 19.4866,8.41493 20.3023,8.98966 20.9857,9.70849 21.6689,10.4271 22.2069,11.276 22.5726,12.2047 22.9383,13.1333 23.1256,14.126 23.1256,15.1268 23.1256,16.1276 22.9383,17.1203 22.5726,18.0489 22.2069,18.9776 21.6689,19.8264 20.9857,20.5451 20.3023,21.2639 19.4866,21.8387 18.583,22.2324 17.6791,22.6262 16.7074,22.83 15.7239,22.83L10.437,22.83 10.437,19.6579 15.7239,19.6579C16.2679,19.6579 16.8086,19.5453 17.3159,19.3243 17.8235,19.1031 18.29,18.7767 18.6867,18.3594 19.0835,17.942 19.4023,17.4422 19.6211,16.8866 19.8399,16.3308 19.9534,15.7326 19.9534,15.1268 19.9534,14.5209 19.8399,13.9227 19.6211,13.367 19.4023,12.8114 19.0835,12.3115 18.6867,11.8941 18.29,11.4769 17.8235,11.1505 17.3159,10.9293 16.8086,10.7083 16.2679,10.5957 15.7239,10.5957L8.71408,10.5957 8.71408,16.8493z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="RedoIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M15.2859,16.8493L23.1255,9.00964 15.2859,1.17001 15.2859,7.42358 8.27607,7.42358C7.29262,7.42358 6.32086,7.62744 5.41703,8.02124 4.51341,8.41493 3.69773,8.98966 3.01434,9.70849 2.33111,10.4271 1.79312,11.276 1.42741,12.2047 1.06174,13.1333 0.874422,14.126 0.874422,15.1268 0.874422,16.1276 1.06174,17.1203 1.42741,18.0489 1.79312,18.9776 2.33111,19.8264 3.01434,20.5451 3.69773,21.2639 4.51341,21.8387 5.41703,22.2324 6.32086,22.6262 7.29262,22.83 8.27607,22.83L13.563,22.83 13.563,19.6579 8.27607,19.6579C7.7321,19.6579 7.19139,19.5453 6.68406,19.3243 6.17652,19.1031 5.70999,18.7767 5.31333,18.3594 4.91651,17.942 4.59775,17.4422 4.37894,16.8866 4.1601,16.3308 4.04656,15.7326 4.04656,15.1268 4.04656,14.5209 4.1601,13.9227 4.37894,13.367 4.59775,12.8114 4.91651,12.3115 5.31333,11.8941 5.70999,11.4769 6.17652,11.1505 6.68406,10.9293 7.19139,10.7083 7.7321,10.5957 8.27607,10.5957L15.2859,10.5957 15.2859,16.8493z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="WhiteboardIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M10.6784,2.72682C10.6784,2.24019,11.0728,1.8457,11.5594,1.8457L12.5245,1.8457C13.0111,1.8457,13.4056,2.24019,13.4056,2.72682L13.4056,3.60777 23.4545,3.60777C23.7557,3.60777,24,3.85198,24,4.15323L24,5.78959C24,6.09083,23.7557,6.33505,23.4545,6.33505L21.8182,6.33505 21.8182,16.0171C21.8182,16.9962,21.019,17.7898,20.033,17.7898L13.3216,17.7898 13.3216,19.4261 15.8182,19.4261C16.1194,19.4261,16.3636,19.6703,16.3636,19.9715L16.3636,21.6079C16.3636,21.9092,16.1194,22.1533,15.8182,22.1533L8.1818,22.1533C7.88055,22.1533,7.63634,21.9092,7.63634,21.6079L7.63634,19.9715C7.63634,19.6703,7.88055,19.4261,8.1818,19.4261L10.5944,19.4261 10.5944,17.7898 3.96693,17.7898C2.98103,17.7898,2.1818,16.9962,2.1818,16.0171L2.1818,6.33505 0.545455,6.33505C0.244211,6.33505,0,6.09083,0,5.78959L0,4.15323C0,3.85198,0.244211,3.60777,0.545455,3.60777L10.6784,3.60777 10.6784,2.72682z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="GestureIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V25 H24 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F0 M24,25z M0,0z M5.23338,7.02449C5.23338,4.04984 7.67384,1.60938 10.6485,1.60938 13.6231,1.60938 16.0636,4.04984 16.0636,7.02449 16.0636,8.71614 15.2582,10.2172 14.0303,11.2128L13.6839,11.1255C13.5766,11.0989,13.4665,11.0856,13.356,11.0858L13.356,7.02449C13.356,5.54792 12.1251,4.31693 10.6485,4.31693 9.17192,4.31693 7.94093,5.54792 7.94093,7.02449L7.94093,11.6807C6.33328,10.7381,5.23338,9.00996,5.23338,7.02449z M10.1933,5.76784C10.3209,5.72261 10.4546,5.69679 10.5899,5.69122 10.68,5.68674 10.7704,5.69093 10.8596,5.70442 10.9041,5.71191 10.9482,5.72163 10.9918,5.73353 11.0356,5.74458 11.0788,5.75783 11.1213,5.77321 11.1637,5.78962 11.2052,5.80814 11.2456,5.82872 11.2863,5.84789 11.326,5.86907 11.3646,5.8922 11.4795,5.96446 11.5829,6.05361 11.6713,6.15663 11.7004,6.1905 11.7277,6.22578 11.7533,6.26235 11.832,6.37325 11.8935,6.49537 11.9357,6.62459 11.9776,6.75361 11.9999,6.8882 12.0018,7.02385L12.0018,12.439 13.3556,12.439C13.4661,12.4388,13.5762,12.4521,13.6835,12.4786L19.0986,13.8324C19.3917,13.9056 19.6519,14.0747 19.8378,14.3128 20.0237,14.5509 20.1246,14.8444 20.1245,15.1465L20.1245,20.5616C20.1245,21.6898 19.3607,22.6265 18.6993,22.9572 18.038,23.2879 17.417,23.2692 17.417,23.2692L10.6481,23.2692C10.6287,23.2688 10.6093,23.2681 10.5899,23.2669 10.5528,23.2657 10.5157,23.263 10.4788,23.2588 10.4674,23.2571 10.4559,23.2553 10.4445,23.2533 10.4179,23.2488 10.3914,23.2436 10.3651,23.2375 10.3421,23.2328 10.3192,23.2275 10.2964,23.2217 10.2831,23.2183 10.2699,23.2146 10.2567,23.2108 10.2282,23.2021 10.2,23.1924 10.1721,23.1817 10.1552,23.175 10.1385,23.168 10.1219,23.1606 10.0969,23.1499 10.0722,23.1384 10.0478,23.1262 10.0273,23.1162 10.007,23.1056 9.98704,23.0945 9.97099,23.0861 9.95513,23.0773 9.93944,23.0681 9.91789,23.0547 9.89673,23.0406 9.87598,23.0259 9.86261,23.0173 9.84939,23.0085 9.83632,22.9995L9.80724,22.9757 4.42121,18.9382C4.14989,18.7357 3.96425,18.439 3.90089,18.1064 3.83752,17.7739 3.90103,17.4297 4.07889,17.1417 4.25676,16.8536 4.53607,16.6427 4.86177,16.5504 5.18747,16.4581 5.53593,16.4912 5.83845,16.6431L9.29429,18.3723 9.29429,13.7927 9.29429,7.02385C9.2949,6.97253 9.29843,6.9213 9.30486,6.87039 9.3106,6.82593 9.31854,6.78179 9.32866,6.73812 9.36928,6.56187 9.4448,6.39554 9.55076,6.24896 9.63093,6.1391 9.7272,6.04194 9.83633,5.96076 9.87205,5.93338 9.90911,5.90782 9.94738,5.88414 10.0252,5.83722 10.1076,5.79825 10.1933,5.76784z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="MoreIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M3.336,1.17001C2.13975,1.17001,1.17,2.13976,1.17,3.33601L1.17,8.75101C1.17,9.94726,2.13975,10.917,3.336,10.917L8.751,10.917C9.94725,10.917,10.917,9.94726,10.917,8.75101L10.917,3.33601C10.917,2.13976,9.94725,1.17001,8.751,1.17001L3.336,1.17001z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M15.249,1.17001C14.0527,1.17001,13.083,2.13976,13.083,3.33601L13.083,8.75101C13.083,9.94726,14.0527,10.917,15.249,10.917L20.664,10.917C21.8602,10.917,22.83,9.94726,22.83,8.75101L22.83,3.33601C22.83,2.13976,21.8602,1.17001,20.664,1.17001L15.249,1.17001z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M3.336,13.083C2.13975,13.083,1.17,14.0528,1.17,15.249L1.17,20.664C1.17,21.8603,2.13975,22.83,3.336,22.83L8.751,22.83C9.94725,22.83,10.917,21.8603,10.917,20.664L10.917,15.249C10.917,14.0528,9.94725,13.083,8.751,13.083L3.336,13.083z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M15.249,13.083C14.0527,13.083,13.083,14.0528,13.083,15.249L13.083,20.664C13.083,21.8603,14.0527,22.83,15.249,22.83L20.664,22.83C21.8602,22.83,22.83,21.8603,22.83,20.664L22.83,15.249C22.83,14.0528,21.8602,13.083,20.664,13.083L15.249,13.083z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="FoldIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#222222" Geometry="F0 M24,24z M0,0z M22.8347,21.5006L2.50417,1.17001 1.16525,2.50893 5.45737,6.80104C3.85257,8.10197 2.53265,9.72576 1.64954,11.5964 1.53559,11.8433 1.52609,12.1282 1.63055,12.3751L1.63055,12.3941C1.63055,12.4131 1.64954,12.4321 1.65904,12.4606 1.68752,12.5175 1.72551,12.5935 1.77299,12.698 1.87744,12.8974 2.01988,13.1822 2.21929,13.5146 2.61812,14.1793 3.21635,15.0719 4.04249,15.9645 5.69477,17.7497 8.30612,19.5919 11.981,19.5919 13.7282,19.5919 15.4375,19.1551 16.9568,18.31L21.4768,22.83 22.8158,21.4911 22.8347,21.5006z M11.9905,15.8791C12.5033,15.8696 13.0066,15.7556 13.4719,15.5467 13.6428,15.4707 13.7852,15.3758 13.9372,15.2808L8.72394,10.0676C8.62898,10.2195 8.53402,10.3715 8.45805,10.5329 8.24915,10.9982 8.1257,11.5015 8.1257,12.0143 8.1162,12.527 8.21116,13.0303 8.40108,13.5051 8.591,13.9799 8.87587,14.4072 9.23671,14.768 9.59755,15.1289 10.0249,15.4138 10.4997,15.6037 10.9745,15.7936 11.4777,15.8791 11.9905,15.8791z" />
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M10.9063,6.37657C11.2749,6.33269 11.6452,6.30726 12,6.30726 14.974,6.30726 17.1134,7.78595 18.5447,9.32737 19.2601,10.0978 19.7852,10.8712 20.1309,11.4519 20.2587,11.6665 20.3611,11.8535 20.4389,12.0025 20.0809,12.6966 19.6562,13.3505 19.1703,13.9543L18.5749,14.694 20.0544,15.8848 20.6498,15.145C21.3248,14.3064 21.8966,13.387 22.3556,12.4078 22.4706,12.1625 22.475,11.8789 22.3683,11.6299L22.3669,11.6266 22.364,11.6201 22.3551,11.5998C22.3477,11.5833 22.3375,11.5605 22.3243,11.5319 22.2979,11.4748 22.2598,11.3946 22.2098,11.2945 22.1097,11.0944 21.9615,10.8142 21.7628,10.4805 21.3666,9.81482 20.7641,8.92644 19.9364,8.03508 18.2816,6.25295 15.6731,4.4081 12,4.4081 11.5572,4.4081 11.1108,4.43965 10.6818,4.49072L9.73885,4.60297 9.96336,6.48883 10.9063,6.37657z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Window.Resources>
<Grid>
<Grid>
<Popup Name="PenPaletteV2Popup" PopupAnimation="Fade" IsOpen="False" StaysOpen="True" AllowsTransparency="True" Placement="Relative">
<popups:ColorPalette Loaded="PenPaletteV2_Loaded" x:Name="PenPaletteV2" Width="300" />
</Popup>
</Grid>
<Grid>
<Popup Name="SelectionPopupV2" PopupAnimation="Fade" IsOpen="False" StaysOpen="True" AllowsTransparency="True" Placement="Relative">
<popups:SelectionPopup Loaded="SelectionV2_Loaded" x:Name="SelectionV2" Width="300" />
</Popup>
</Grid>
<Grid>
<Popup Name="ShapeDrawingPopupV2" PopupAnimation="Fade" IsOpen="False" StaysOpen="True" AllowsTransparency="True" Placement="Relative">
<popups:ShapeDrawingPopup Loaded="ShapeDrawingV2_Loaded" x:Name="ShapeDrawingV2" Width="570" />
</Popup>
</Grid>
<!--这一部分是用于展示工具栏的对齐和贴边提示的Popup-->
<Grid Name="PlacementFeedbackPopups">
<Popup Name="PlacementFeedbackPopup" Placement="Absolute" StaysOpen="True" AllowsTransparency="True" IsOpen="False">
<Border Background="#883b82f6" IsHitTestVisible="False" Name="PlaceFeedbackBorder">
<TextBlock Name="PlacementFeedbackTipText" FontSize="16" FontWeight="Bold" Foreground="#dbeafe" Margin="6"/>
</Border>
</Popup>
</Grid>
<Grid Name="ToolbarV2" RenderTransformOrigin=".5,.5">
<Grid Name="ToolBarV2Grid" HorizontalAlignment="Left" Margin="24" Height="48">
<DockPanel Name="FallbackBackgroundLayer">
<DockPanel.Effect>
<DropShadowEffect Opacity="0.01" Direction="0" ShadowDepth="0.1" BlurRadius="0.01"></DropShadowEffect>
</DockPanel.Effect>
<Image DockPanel.Dock="Left" Height="48" HorizontalAlignment="Left">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V120 H63 V0 H0 Z">
<GeometryDrawing Brush="#fafafa" Geometry="F1 M63,120z M0,0z M62.6465,-0.00390625L60.3128,-0.00390625C34.3338,-0.00390625 21.3443,-0.00390625 12.5491,7.09435 10.7817,8.52078 9.17117,10.1313 7.74474,11.8988 0.646484,20.6939 0.646484,33.6834 0.646484,59.6624 0.646484,85.6414 0.646484,98.6309 7.74474,107.426 9.17117,109.194 10.7817,110.804 12.5491,112.23 21.3443,119.329 34.3338,119.329 60.3128,119.329L62.6465,119.329 62.6465,-0.00390625z"/>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<Image DockPanel.Dock="Right" Height="48" HorizontalAlignment="Left">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V120 H63 V0 H0 Z">
<GeometryDrawing Brush="#fafafa" Geometry="F1 M63,120z M0,0z M0.447266,119.495L2.78091,119.495C28.7599,119.495 41.7495,119.495 50.5446,112.396 52.312,110.97 53.9226,109.36 55.349,107.592 62.4473,98.797 62.4473,85.8074 62.4473,59.8284 62.4473,33.8494 62.4473,20.8599 55.349,12.0648 53.9226,10.2973 52.312,8.6868 50.5446,7.26037 41.7495,0.162109 28.7599,0.162109 2.78091,0.162109L0.447266,0.162109 0.447266,119.495z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<Border Background="#fafafa" Height="48" Margin="-1,0,-1,0.25" VerticalAlignment="Center"></Border>
</DockPanel>
<Image Name="MainBackgroundLayer">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup x:Name="BackgroundBorderDrawingGroup">
<GeometryDrawing Brush="#fafafa" x:Name="ToolBarBackgroundBorder">
<GeometryDrawing.Pen>
<Pen Brush="#d4d4d8" Thickness="3"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<StackPanel Orientation="Horizontal" Margin="4,0">
<Grid Name="HeadIcon" RenderTransformOrigin=".5,.5" MouseMove="HeadIconButton_MouseMove" MouseDown="HeadIconButton_MouseDown" MouseUp="HeadIconButton_MouseUp" Width="42" Height="42" Margin="0,0,2,0">
<Image Name="HeadIconImage" Height="42" Width="42" Source="../Resources/Icons-png/icc-toolbar-v2.png" RenderOptions.BitmapScalingMode="HighQuality"></Image>
</Grid>
<ItemsControl Name="ToolBarItemsControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:FloatingBarItem}">
<StackPanel Orientation="Horizontal">
<Grid RenderTransformOrigin=".5,.5" MouseDown="ToolbarButton_MouseDown" MouseUp="ToolbarButton_MouseUp" MouseLeave="ToolbarButton_MouseLeave" Tag="{Binding}" Visibility="{Binding _itemVisibility}" Margin="2,0,0,0" Width="42" Height="42">
<Image Height="42" Width="42">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V120 H120 V0 H0 Z">
<GeometryDrawing Brush="{Binding _backgroundBrush}" Geometry="F1 M120,120z M0,0z M0.443359,59.9384C0.443359,33.9607 0.443359,20.9718 7.54095,12.1769 8.96777,10.4089 10.5788,8.79785 12.3468,7.37103 21.1418,0.273438 34.1306,0.273438 60.1084,0.273438 86.0861,0.273438 99.075,0.273438 107.87,7.37103 109.638,8.79785 111.249,10.4089 112.676,12.1769 119.773,20.9718 119.773,33.9607 119.773,59.9384 119.773,85.9162 119.773,98.905 112.676,107.7 111.249,109.468 109.638,111.079 107.87,112.506 99.075,119.603 86.0861,119.603 60.1084,119.603 34.1306,119.603 21.1418,119.603 12.3468,112.506 10.5788,111.079 8.96777,109.468 7.54095,107.7 0.443359,98.905 0.443359,85.9162 0.443359,59.9384z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<Image Height="42" Width="42" Opacity="0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V120 H120 V0 H0 Z">
<GeometryDrawing Brush="{Binding _pressFeedbackColorBrush}" Geometry="F1 M120,120z M0,0z M0.443359,59.9384C0.443359,33.9607 0.443359,20.9718 7.54095,12.1769 8.96777,10.4089 10.5788,8.79785 12.3468,7.37103 21.1418,0.273438 34.1306,0.273438 60.1084,0.273438 86.0861,0.273438 99.075,0.273438 107.87,7.37103 109.638,8.79785 111.249,10.4089 112.676,12.1769 119.773,20.9718 119.773,33.9607 119.773,59.9384 119.773,85.9162 119.773,98.905 112.676,107.7 111.249,109.468 109.638,111.079 107.87,112.506 99.075,119.603 86.0861,119.603 60.1084,119.603 34.1306,119.603 21.1418,119.603 12.3468,112.506 10.5788,111.079 8.96777,109.468 7.54095,107.7 0.443359,98.905 0.443359,85.9162 0.443359,59.9384z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<Image Height="{Binding IconHeight}" Source="{Binding IconSource}"/>
</Grid>
<Border Opacity="{Binding _separatorOpacity}" Visibility="{Binding _separatorVisibility}" Width="1" Height="28" CornerRadius="0.5" Background="#e1e1e1" Margin="3,0,1,0"></Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>
@@ -0,0 +1,936 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using static Ink_Canvas.Popups.ColorPalette;
using static Ink_Canvas.Popups.SelectionPopup;
using static Ink_Canvas.Popups.ShapeDrawingPopup;
namespace Ink_Canvas
{
public enum FloatingBarItemType {
Button,
StateButton,
Separator
}
public class FloatingBarItem {
public string Name { get; set; }
public ImageSource IconSource { get; set; }
public bool Selected { get; set; } = false;
public bool IsVisible { get; set; } = true;
public string IconSourceResourceKey { get; set; }
public double IconHeight { get; set; } = 21;
public Color? IconColor { get; set; } = null; // 该属性仅用于纯色图标用于在动态透明模式下恢复图标原来的自定义颜色
public bool IsSemiTransparent { get; set; } = false;
public Color? PressFeedbackColor { get; set; } = null;
public FloatingBarItemType Type { get; set; }
public MainWindow.ICCToolsEnum ToolType { get; set; }
public SolidColorBrush _backgroundBrush {
get {
if (Selected) return new SolidColorBrush(Color.FromArgb((byte)(IsSemiTransparent ? 128 : 255) ,37, 99, 235));
return new SolidColorBrush(Colors.Transparent);
}
}
public Visibility _itemVisibility {
get {
if (!IsVisible) return Visibility.Collapsed;
return Type != FloatingBarItemType.Separator ? Visibility.Visible : Visibility.Collapsed;
}
}
public Visibility _separatorVisibility {
get {
if (!IsVisible) return Visibility.Collapsed;
return Type != FloatingBarItemType.Separator ? Visibility.Collapsed : Visibility.Visible;
}
}
public double _separatorOpacity {
get => IsSemiTransparent ? 0.35 : 1;
}
public SolidColorBrush _pressFeedbackColorBrush {
get {
if (PressFeedbackColor == null) return new SolidColorBrush(Color.FromArgb((byte)(IsSemiTransparent ? 96 : 255),225, 225, 225));
return new SolidColorBrush(Color.FromArgb((byte)(IsSemiTransparent ? 96 : 255),((Color)PressFeedbackColor).R,
((Color)PressFeedbackColor).G, ((Color)PressFeedbackColor).B));
}
}
}
/// <summary>
/// FloatingToolBarV2.xaml 的交互逻辑
/// </summary>
public partial class FloatingToolBarV2 : Window {
public FloatingToolBarV2() {
InitializeComponent();
ToolBarItemsControl.ItemsSource = ToolbarItems;
//var clonedDrawing = (FindResource("CursorIcon") as DrawingImage).Clone();
//((clonedDrawing.Drawing as DrawingGroup).Children[0] as
// GeometryDrawing).Brush = new SolidColorBrush(Colors.Black);
ToolbarItems.Add(new FloatingBarItem() {
Name = "Cursor",
IconSource = FindResource("CursorIcon") as DrawingImage,
IconSourceResourceKey = "CursorIcon",
IsVisible = true,
Selected = false,
IconHeight = 21.5,
ToolType = MainWindow.ICCToolsEnum.CursorMode,
Type = FloatingBarItemType.StateButton,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Pen",
IconSource = FindResource("PenIcon") as DrawingImage,
IconSourceResourceKey = "PenIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
ToolType = MainWindow.ICCToolsEnum.PenMode,
Type = FloatingBarItemType.StateButton,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Clear",
IconSource = FindResource("TrashBinIcon") as DrawingImage,
IconSourceResourceKey = "TrashBinIcon",
IsVisible = true,
IconColor = Color.FromRgb(224, 27, 36),
IconHeight = 22,
Selected = false,
PressFeedbackColor = Color.FromRgb(254, 226, 226),
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "SeparatorA",
IsVisible = true,
Type = FloatingBarItemType.Separator,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Eraser",
IconSource = FindResource("EraserIcon") as DrawingImage,
IconSourceResourceKey = "EraserIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
ToolType = MainWindow.ICCToolsEnum.EraseByGeometryMode,
Type = FloatingBarItemType.StateButton,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "ShapeDrawing",
IconSource = FindResource("ShapesIcon") as DrawingImage,
IconSourceResourceKey = "ShapesIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Select",
IconSource = FindResource("SelectIcon") as DrawingImage,
IconSourceResourceKey = "SelectIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
ToolType = MainWindow.ICCToolsEnum.LassoMode,
Type = FloatingBarItemType.StateButton,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "SeparatorB",
IsVisible = true,
Type = FloatingBarItemType.Separator,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Undo",
IconSource = FindResource("UndoIcon") as DrawingImage,
IconSourceResourceKey = "UndoIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Redo",
IconSource = FindResource("RedoIcon") as DrawingImage,
IconSourceResourceKey = "RedoIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "SeparatorC",
IsVisible = true,
Type = FloatingBarItemType.Separator,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Whiteboard",
IconSource = FindResource("WhiteboardIcon") as DrawingImage,
IconSourceResourceKey = "WhiteboardIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Gesture",
IconSource = FindResource("GestureIcon") as DrawingImage,
IconSourceResourceKey = "GestureIcon",
IsVisible = true,
IconHeight = 23,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Menu",
IconSource = FindResource("MoreIcon") as DrawingImage,
IconSourceResourceKey = "MoreIcon",
IsVisible = true,
IconHeight = 21.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ToolbarItems.Add(new FloatingBarItem() {
Name = "Fold",
IconSource = FindResource("FoldIcon") as DrawingImage,
IconSourceResourceKey = "FoldIcon",
IsVisible = true,
IconHeight = 22.5,
Selected = false,
Type = FloatingBarItemType.Button,
});
ReMeasureToolBar();
UpdateToolBarSelectedTool(MainWindow.ICCToolsEnum.CursorMode);
UpdateToolBarVariant(1);
UpdateToolBarDynamicOpacityVariant(1);
double widthInDevicePixels = GetSystemMetrics(0); // SM_CXSCREEN
double widthInDIP = SystemParameters.WorkArea.Right; // Device independent pixels.
double scalingFactor = widthInDIP/widthInDevicePixels;
ScalingFactor = scalingFactor;
}
public void FloatingBarV2_Loaded(object sender, RoutedEventArgs e) {
}
public void HideAllPopups() {
PenPaletteV2Popup.IsOpen = false;
SelectionPopupV2.IsOpen = false;
ShapeDrawingPopupV2.IsOpen = false;
}
#region PopupV2
/// <summary>
/// 绑定调色盘V2的事件,部分事件会在内部进行处理后转发到外部
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PenPaletteV2_Loaded(object sender, RoutedEventArgs e) {
PenPaletteV2.ColorSelectionChanged += (o, args) => {
PenPaletteV2_ColorSelectionChanged?.Invoke(o, args);
};
PenPaletteV2.CustomColorChanged += (o, args) => {
PenPaletteV2_CustomColorChanged?.Invoke(o, args);
};
PenPaletteV2.PenModeChanged += (o, args) => {
PenPaletteV2_PenModeChanged?.Invoke(o, args);
};
PenPaletteV2.InkRecognitionChanged += (o, args) => {
PenPaletteV2_InkRecognitionChanged?.Invoke(o, args);
};
PenPaletteV2.PressureSimulationChanged += (o, args) => {
PenPaletteV2_PressureSimulationChanged?.Invoke(o, args);
};
PenPaletteV2.ColorModeChanged += (o, args) => {
PenPaletteV2_ColorModeChanged?.Invoke(o, args);
};
PenPaletteV2.QuickActionsVisibilityChanged += (o, args) => {
PenPaletteV2_QuickActionsVisibilityChanged?.Invoke(o, args);
};
PenPaletteV2.PaletteShouldCloseEvent += (o, args) => {
PenPaletteV2Popup.IsOpen = false;
PenPaletteV2_PaletteShouldCloseEvent?.Invoke(o, args);
};
}
public event EventHandler<ColorSelectionChangedEventArgs> PenPaletteV2_ColorSelectionChanged;
public event EventHandler<CustomColorChangedEventArgs> PenPaletteV2_CustomColorChanged;
public event EventHandler<PenModeChangedEventArgs> PenPaletteV2_PenModeChanged;
public event EventHandler<InkRecognitionChangedEventArgs> PenPaletteV2_InkRecognitionChanged;
public event EventHandler<PressureSimulationChangedEventArgs> PenPaletteV2_PressureSimulationChanged;
public event EventHandler<ColorModeChangedEventArgs> PenPaletteV2_ColorModeChanged;
public event EventHandler<QuickActionsVisibilityChangedEventsArgs> PenPaletteV2_QuickActionsVisibilityChanged;
public event EventHandler<RoutedEventArgs> PenPaletteV2_PaletteShouldCloseEvent;
/// <summary>
/// 绑定选择弹窗V2的事件,部分事件会在内部进行处理后转发到外部
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectionV2_Loaded(object sender, RoutedEventArgs e) {
SelectionV2.SelectionPopupShouldCloseEvent += (o, args) => {
SelectionPopupV2.IsOpen = false;
SelectionV2_SelectionPopupShouldCloseEvent?.Invoke(o, args);
};
SelectionV2.SelectAllEvent += (o, args) => {
SelectionV2_SelectAllEvent?.Invoke(o, args);
};
SelectionV2.UnSelectEvent += (o, args) => {
SelectionV2_UnSelectEvent?.Invoke(o, args);
};
SelectionV2.ReverseSelectEvent += (o, args) => {
SelectionV2_ReverseSelectEvent?.Invoke(o, args);
};
SelectionV2.ApplyScaleToStylusTipChanged += (o, args) => {
SelectionV2_ApplyScaleToStylusTipChanged?.Invoke(o, args);
};
SelectionV2.OnlyHitTestFullyContainedStrokesChanged += (o, args) => {
SelectionV2_OnlyHitTestFullyContainedStrokesChanged?.Invoke(o, args);
};
SelectionV2.AllowClickToSelectLockedStrokeChanged += (o, args) => {
SelectionV2_AllowClickToSelectLockedStrokeChanged?.Invoke(o, args);
};
SelectionV2.SelectionModeChanged += (o, args) => {
SelectionV2_SelectionModeChanged?.Invoke(o, args);
};
}
public event EventHandler<RoutedEventArgs> SelectionV2_SelectionPopupShouldCloseEvent;
public event EventHandler<RoutedEventArgs> SelectionV2_SelectAllEvent;
public event EventHandler<RoutedEventArgs> SelectionV2_UnSelectEvent;
public event EventHandler<RoutedEventArgs> SelectionV2_ReverseSelectEvent;
public event EventHandler<RoutedEventArgs> SelectionV2_ApplyScaleToStylusTipChanged;
public event EventHandler<RoutedEventArgs> SelectionV2_OnlyHitTestFullyContainedStrokesChanged;
public event EventHandler<RoutedEventArgs> SelectionV2_AllowClickToSelectLockedStrokeChanged;
public event EventHandler<SelectionModeChangedEventArgs> SelectionV2_SelectionModeChanged;
/// <summary>
/// 绑定形状绘制弹窗V2的事件,部分事件会在内部进行处理后转发到外部
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ShapeDrawingV2_Loaded(object sender, RoutedEventArgs e) {
ShapeDrawingV2.ShapeDrawingPopupShouldCloseEvent += (o, args) => {
ShapeDrawingPopupV2.IsOpen = false;
ShapeDrawingV2_ShapeDrawingPopupShouldCloseEvent?.Invoke(o, args);
};
ShapeDrawingV2.ShapeSelectedEvent += (o, args) => {
ShapeDrawingV2_ShapeSelectedEvent?.Invoke(o, args);
};
}
public event EventHandler<RoutedEventArgs> ShapeDrawingV2_ShapeDrawingPopupShouldCloseEvent;
public event EventHandler<ShapeSelectedEventArgs> ShapeDrawingV2_ShapeSelectedEvent;
#endregion
private double ScalingFactor;
public ObservableCollection<FloatingBarItem> ToolbarItems { get; set; } =
new ObservableCollection<FloatingBarItem>();
private Grid _mouseDownButton = null;
private bool _isMouseDownHeadIcon = false;
private double CaculateToolBarWindowWidth(Collection<FloatingBarItem> toolbarItems) {
// ------------------------------------------------------//
var containerMargin = 4D; // 内容StackPanel的Margin
var itemWidth = 42D; // 按钮宽度
var itemsSpacing = 2D; // 按钮之间的间距
var headIconSpacingRight = 4D; // icc图标的右间距
var separatorWidth = 1D; // 分隔符宽度
var separatorSpacing = 3D; // 分隔符左右的间距
// ------------------------------------------------------//
var _width = containerMargin * 2 + itemWidth + headIconSpacingRight - itemsSpacing;
foreach (var i in toolbarItems) {
if (!i.IsVisible) continue;
if (i.Type != FloatingBarItemType.Separator) _width += itemsSpacing + itemWidth;
else _width += separatorSpacing + separatorWidth + separatorSpacing - itemsSpacing;
}
return _width;
}
/// <summary>
/// 修改工具栏的变体
/// </summary>
/// <param name="variant">0为全长,1为鼠标模式下变体,2为迷你,3为仅HeadIcon图标</param>
private void UpdateToolBarVariant(int variant) {
var _snapTypeTemp = SnapType;
ToolBarNowVariantMode = variant;
HideAllPopups();
IEnumerable<FloatingBarItem> items;
if (variant == 0) items = ToolbarItems.AsEnumerable();
else if (variant == 1)
items = ToolbarItems.Where((item, i) => (new string[] {
"Cursor", "Pen", "Clear", "SeparatorC", "Whiteboard", "Gesture", "Menu", "Fold"
}).Contains(item.Name));
else if (variant == 2)
items = ToolbarItems.Where((item, i) => (new string[] {
"Cursor", "Pen", "Clear"
}).Contains(item.Name));
else if (variant == 3)
items = ToolbarItems.Where((item, i) => item.Selected);
else return;
foreach (var fi in ToolbarItems) {
fi.IsVisible = items.Contains(fi);
}
CollectionViewSource.GetDefaultView(ToolbarItems).Refresh();
ReMeasureToolBar();
if (_snapTypeTemp == ToolBarSnapType.RightSide) {
Left = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24;
} else if (_snapTypeTemp == ToolBarSnapType.RightTopCorner) {
Top = -24;
Left = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24;
} else if (_snapTypeTemp == ToolBarSnapType.RightBottomCorner) {
Top = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24;
Left = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24;
}
}
private void UpdateToolBarSelectedTool(MainWindow.ICCToolsEnum type) {
var _i = ToolbarItems.Where((item, i) =>
item.Type == FloatingBarItemType.StateButton &&
item.ToolType == type).Single();
var nowSelected = ToolbarItems.Where((item, i) =>
item.Selected);
if (nowSelected.Any() && nowSelected.Count()==1 && _i == nowSelected.Single()) return;
foreach (var fi in ToolbarItems) {
if (fi.Type == FloatingBarItemType.Separator) continue;
fi.Selected = false;
fi.IconSource = FindResource(fi.IconSourceResourceKey) as ImageSource;
}
_i.Selected = true;
var clonedIcon = _i.IconSource.Clone() as DrawingImage;
foreach (var d in (clonedIcon.Drawing as DrawingGroup).Children)
((GeometryDrawing)d).Brush = new SolidColorBrush(Colors.White);
_i.IconSource = clonedIcon;
CollectionViewSource.GetDefaultView(ToolbarItems).Refresh();
}
private void ReMeasureToolBar() {
var barWidth = CaculateToolBarWindowWidth(ToolbarItems);
ToolBarV2Grid.Width = barWidth;
Width = barWidth + 24 * 2; // 6是工具栏和窗口的Margin
Height = 48 + 24 * 2; // 48是工具栏高度
var offset = ToolBarNowVariantMode == 3 ? 0 : 6;
var offsetCp = ToolBarNowVariantMode == 3 ? 0.5 : 6.5;
var path = GenerateSuperEllipsePathByContentWidth(barWidth + offset, 48);
ToolBarBackgroundBorder.Geometry = Geometry.Parse(path);
var cg = GenerateSuperEllipsePathClipGeometry(barWidth + offsetCp, 48);
BackgroundBorderDrawingGroup.ClipGeometry = Geometry.Parse(cg);
Top = Math.Max(Math.Min(Top,
System.Windows.SystemParameters.PrimaryScreenHeight-ActualHeight +24),-24);
Left = Math.Max(Math.Min(Left,
System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth +24),-24);
}
public int ToolBarNowVariantMode = -1;
private string GenerateSuperEllipsePathClipGeometry(double width, double renderingHeight) {
double acutalHeight = 119.33;
double renderingScalingFactor = acutalHeight / renderingHeight;
double actualFullWidth = width * renderingScalingFactor;
double actualCenterWidth = actualFullWidth - 119.34 < 0 ? 0 : actualFullWidth - 119.34;
var cg = $"M0,0 V120 H{Math.Round(actualFullWidth, 0)} V0 H0 Z";
return cg;
}
/// <summary>
/// 根据给定的渲染高度计算比例,并根据实际内容宽度计算超椭圆圆角矩形的SVG路径
/// </summary>
/// <param name="width"></param>
/// <param name="renderingHeight"></param>
/// <returns></returns>
private string GenerateSuperEllipsePathByContentWidth(double width, double renderingHeight) {
double acutalHeight = 119.33;
double renderingScalingFactor = acutalHeight / renderingHeight;
double actualFullWidth = width * renderingScalingFactor;
double actualCenterWidth = actualFullWidth - 119.34 < 0 ? 0 : actualFullWidth - 119.34;
var sb = "M64.3285 "
+ "0.015625"
+ $"H{Math.Round(64.3395 + actualCenterWidth,3)}"
+ $"C{Math.Round(90.3185 + actualCenterWidth,3)} "
+ "0.015625 "
+ $"{Math.Round(99.3081 + actualCenterWidth, 3)} "
+ "0.015625 "
+ $"{Math.Round(108.103 + actualCenterWidth, 3)} "
+ "7.11388"
+ $"C{Math.Round(109.871 + actualCenterWidth, 3)} "
+ "8.54031 "
+ $"{Math.Round(111.481 + actualCenterWidth, 3)} "
+ "10.1509 "
+ $"{Math.Round(112.908 + actualCenterWidth, 3)} "
+ "11.9183"
+ $"C{Math.Round(120.006 + actualCenterWidth, 3)} "
+ "20.7134 "
+ $"{Math.Round(120.006 + actualCenterWidth, 3)} "
+ "33.7029 "
+ $"{Math.Round(120.006 + actualCenterWidth, 3)} "
+ "59.6819"
+ $"C{Math.Round(120.006 + actualCenterWidth, 3)} "
+ "85.661 "
+ $"{Math.Round(120.006 + actualCenterWidth, 3)} "
+ "98.6505 "
+ $"{Math.Round(112.908 + actualCenterWidth, 3)} "
+ "107.446"
+ $"C{Math.Round(111.481 + actualCenterWidth, 3)} "
+ "109.213 "
+ $"{Math.Round(109.871 + actualCenterWidth, 3)} "
+ "110.824 "
+ $"{Math.Round(108.103 + actualCenterWidth, 3)} "
+ "112.25"
+ $"C{Math.Round(99.3081 + actualCenterWidth, 3)} "
+ "119.348 "
+ $"{Math.Round(90.3185 + actualCenterWidth, 3)} "
+ "119.348 "
+ $"{Math.Round(64.3395 + actualCenterWidth, 3)} "
+ "119.348"
+ "H64.3285C38.3494 "
+ "119.348 "
+ "21.3599 "
+ "119.348 "
+ "12.5648 "
+ "112.25"
+ "C10.7973 "
+ "110.824 "
+ "9.1868 "
+ "109.213 "
+ "7.76037 "
+ "107.446"
+ "C0.662109 "
+ "98.6505 "
+ "0.662109 "
+ "85.661 "
+ "0.662109 "
+ "59.6819"
+ "C0.662109 "
+ "33.7029 "
+ "0.662109 "
+ "20.7134 "
+ "7.76037 "
+ "11.9183"
+ "C9.1868 "
+ "10.1509 "
+ "10.7973 "
+ "8.54031 "
+ "12.5648 "
+ "7.11388"
+ "C21.3599 "
+ "0.015625 "
+ "38.3494 "
+ "0.015625 "
+ "64.3285 "
+ "0.015625"
+ "Z";
return sb;
}
public enum ToolBarSnapType {
NoSnap,
LeftTopCorner,
RightTopCorner,
LeftBottomCorner,
RightBottomCorner,
RightSide,
LeftSide,
BottomSide,
TopSide
}
public ToolBarSnapType SnapType {
get {
if (Top <= -24 && Left <= -24) return ToolBarSnapType.LeftTopCorner;
if (Top >= System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24 && Left <= -24) return ToolBarSnapType.LeftBottomCorner;
if (Top <= -24 && Left >= System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24) return ToolBarSnapType.RightTopCorner;
if (Top >= System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24 &&
Left >= System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24) return ToolBarSnapType.RightBottomCorner;
if (Top <= -24) return ToolBarSnapType.TopSide;
if (Top >= System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24)
return ToolBarSnapType.BottomSide;
if (Left <= -24) return ToolBarSnapType.LeftSide;
if (Left >= System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24)
return ToolBarSnapType.RightSide;
return ToolBarSnapType.NoSnap;
}
}
public event EventHandler<EventArgs> FloatingBarToolSelectionChanged;
public event EventHandler<EventArgs> FloatingBarToolButtonClicked;
private void OnToolSelectionChanged(FloatingBarItem sender) {
if (ToolBarNowVariantMode == 3) return;
Dispatcher.InvokeAsync(() => HideAllPopups());
if (sender.Selected && sender.ToolType != MainWindow.ICCToolsEnum.CursorMode) {
if (ToolBarNowVariantMode != 0) UpdateToolBarVariant(0);
} else {
if (ToolBarNowVariantMode != 1) UpdateToolBarVariant(1);
}
FloatingBarToolSelectionChanged?.Invoke(sender,EventArgs.Empty);
}
private void OnToolButtonClicked(FloatingBarItem sender, Grid container) {
if (sender.ToolType == MainWindow.ICCToolsEnum.PenMode) {
if (PenPaletteV2Popup.IsOpen) {
HideAllPopups();
} else {
var containerPoint = container.TranslatePoint(new Point(0, 0), ToolBarV2Grid);
PenPaletteV2Popup.HorizontalOffset = containerPoint.X;
if (System.Windows.SystemParameters.PrimaryScreenHeight - Top - Height + 24 > PenPaletteV2.Height) PenPaletteV2Popup.VerticalOffset = Height -24 ;
else PenPaletteV2Popup.VerticalOffset = 0 - PenPaletteV2.Height + 24;
PenPaletteV2Popup.IsOpen = true;
}
} else if (sender.ToolType == MainWindow.ICCToolsEnum.LassoMode) {
if (SelectionPopupV2.IsOpen) {
HideAllPopups();
} else {
var containerPoint = container.TranslatePoint(new Point(0, 0), ToolBarV2Grid);
SelectionPopupV2.HorizontalOffset = containerPoint.X;
if (System.Windows.SystemParameters.PrimaryScreenHeight - Top - Height + 24 > SelectionV2.Height) SelectionPopupV2.VerticalOffset = Height - 24 ;
else SelectionPopupV2.VerticalOffset = 0 - SelectionV2.Height + 24;
SelectionPopupV2.IsOpen = true;
}
} else if (sender.Name == "ShapeDrawing") {
if (ShapeDrawingPopupV2.IsOpen) {
HideAllPopups();
} else {
var containerPoint = container.TranslatePoint(new Point(0, 0), ToolBarV2Grid);
ShapeDrawingPopupV2.HorizontalOffset = containerPoint.X;
if (System.Windows.SystemParameters.PrimaryScreenHeight - Top - Height + 24 > ShapeDrawingV2.Height) ShapeDrawingPopupV2.VerticalOffset = Height - 24 ;
else ShapeDrawingPopupV2.VerticalOffset = 0 - ShapeDrawingV2.Height + 24;
ShapeDrawingPopupV2.IsOpen = true;
}
}
FloatingBarToolButtonClicked?.Invoke(sender,EventArgs.Empty);
}
private void ToolbarButton_MouseDown(object sender, MouseButtonEventArgs e) {
if (_mouseDownButton != null) return;
var gd = sender as Grid;
var itemData = gd.Tag as FloatingBarItem;
_mouseDownButton = gd;
if (!itemData.Selected) {
var bgImg = gd.Children[1] as Image;
bgImg.Opacity = 1;
}
gd.RenderTransform = new ScaleTransform(0.9, 0.9);
}
private void ToolbarButton_MouseUp(object sender, MouseButtonEventArgs e) {
if (_mouseDownButton == null || _mouseDownButton != sender) return;
ToolbarButton_MouseLeave(sender, null);
var gd = sender as Grid;
var itemData = gd.Tag as FloatingBarItem;
if (itemData.Type == FloatingBarItemType.StateButton && !itemData.Selected) {
UpdateToolBarSelectedTool(itemData.ToolType);
OnToolSelectionChanged(itemData);
} else {
OnToolButtonClicked(itemData, gd);
}
}
public int DynamicTransparentVariant { get; set; } = 1;
/// <summary>
/// 根据提供的变体ID修改工具栏动态透明的变体类型
/// </summary>
/// <param name="variant">0为透明,1为不透明</param>
private void UpdateToolBarDynamicOpacityVariant(int variant) {
DynamicTransparentVariant = variant;
if (variant == 0) {
FallbackBackgroundLayer.Opacity = 0.05;
ToolBarBackgroundBorder.Pen = new Pen() {
Brush = new SolidColorBrush(Color.FromArgb(48, 34, 34, 34)),
Thickness = 3,
};
ToolBarBackgroundBorder.Brush = new SolidColorBrush(Color.FromArgb(16, 255,255,255));
HeadIcon.Opacity = 0.5;
ToolBarItemsControl.Opacity = 0.92;
foreach (var fi in ToolbarItems) {
fi.IsSemiTransparent = true;
if (fi.Type == FloatingBarItemType.Separator) continue;
if (fi.IconSourceResourceKey == "") continue;
var icon = FindResource(fi.IconSourceResourceKey) as DrawingImage;
foreach (var gd in (icon.Drawing as DrawingGroup).Children) {
var _gd = gd as GeometryDrawing;
_gd.Pen = new Pen() {
Brush = new SolidColorBrush(Color.FromArgb(148, 34,34,34)),
Thickness = 1,
};
if (fi.IconColor != null)
_gd.Brush = new SolidColorBrush(Color.FromArgb(96, (byte)Math.Min(((Color)fi.IconColor).R * 4.25,255),
(byte)Math.Min(((Color)fi.IconColor).G * 4.25,255),(byte)Math.Min(((Color)fi.IconColor).B * 4.25,255)));
else _gd.Brush = new SolidColorBrush(Color.FromArgb(96, 255,255,255));
}
if (fi.Selected) {
var clonedIcon = icon.Clone();
foreach (var d in (clonedIcon.Drawing as DrawingGroup).Children)
((GeometryDrawing)d).Brush = new SolidColorBrush(Colors.White);
fi.IconSource = clonedIcon;
}
}
} else if (variant == 1) {
FallbackBackgroundLayer.Opacity = 1;
ToolBarBackgroundBorder.Pen = new Pen() {
Brush = new SolidColorBrush(Color.FromRgb(212,212,216)),
Thickness = 3,
};
ToolBarBackgroundBorder.Brush = new SolidColorBrush(Color.FromRgb(250, 250, 250));
HeadIcon.Opacity = 1;
ToolBarItemsControl.Opacity = 1;
foreach (var fi in ToolbarItems) {
fi.IsSemiTransparent = false;
if (fi.Type == FloatingBarItemType.Separator) continue;
if (fi.IconSourceResourceKey == "") continue;
var icon = FindResource(fi.IconSourceResourceKey) as DrawingImage;
foreach (var gd in (icon.Drawing as DrawingGroup).Children) {
var _gd = gd as GeometryDrawing;
_gd.Pen = null;
_gd.Brush = new SolidColorBrush(fi.IconColor??Color.FromRgb(34,34,34));
}
if (fi.Selected) {
var clonedIcon = icon.Clone();
foreach (var d in (clonedIcon.Drawing as DrawingGroup).Children)
((GeometryDrawing)d).Brush = new SolidColorBrush(Colors.White);
fi.IconSource = clonedIcon;
}
}
}
CollectionViewSource.GetDefaultView(ToolbarItems).Refresh();
ReMeasureToolBar();
}
[DllImport("USER32.DLL", SetLastError = true)]
public static extern int GetSystemMetrics(int nIndex);
private void ToolbarButton_MouseLeave(object sender, MouseEventArgs e) {
if (_mouseDownButton == null || _mouseDownButton != sender) return;
var itemData = _mouseDownButton.Tag as FloatingBarItem;
if (!itemData.Selected) {
var bgImg = _mouseDownButton.Children[1] as Image;
bgImg.Opacity = 0;
}
_mouseDownButton.RenderTransform = null;
_mouseDownButton = null;
}
#region icc按钮
public Point prevPoint = new Point(0,0);
public bool isInMovingMode = false;
public double winLeft = 0;
public double winTop = 0;
public ToolBarSnapType _snapTypeTemp = ToolBarSnapType.NoSnap;
private void HeadIconButton_MouseDown(object sender, MouseButtonEventArgs e) {
if (_isMouseDownHeadIcon) return;
if (e.RightButton == MouseButtonState.Pressed) {
UpdateToolBarDynamicOpacityVariant(Math.Abs(DynamicTransparentVariant-1));
} else {
_isMouseDownHeadIcon = true;
var gd = sender as Grid;
prevPoint = e.GetPosition(ToolBarV2Grid);
winLeft = Left;
winTop = Top;
Trace.WriteLine(prevPoint);
gd.CaptureMouse();
gd.RenderTransform = new ScaleTransform(0.92, 0.92);
isInMovingMode = false;
_snapTypeTemp = SnapType;
}
}
private void HeadIconButton_MouseMove(object sender, MouseEventArgs e) {
if (_isMouseDownHeadIcon == false) return;
var mp = System.Windows.Forms.Control.MousePosition;
var mpLogical = new Point(mp.X * ScalingFactor, mp.Y * ScalingFactor);
var deltaX = mpLogical.X - prevPoint.X - winLeft - 24;
var deltaY = mpLogical.Y - prevPoint.Y - winTop - 24;
var movingLimitation = _snapTypeTemp == ToolBarSnapType.NoSnap ? 12 : 24;
if (Math.Abs(deltaY) > movingLimitation || Math.Abs(deltaX) > movingLimitation) isInMovingMode = true;
if (isInMovingMode) {
HideAllPopups();
ToolbarV2.RenderTransform = null;
ToolBarV2Grid.RenderTransform = null;
HeadIconImage.RenderTransform = null;
UpdateToolbarPlacementFeedback();
Top = Math.Max(Math.Min(mp.Y * ScalingFactor - prevPoint.Y - 24,
System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight +24),-24);
Left = Math.Max(Math.Min(mp.X * ScalingFactor - prevPoint.X - 24,
System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth +24),-24);
} else {
double tbMovingX = deltaX/3, tbMovingY = deltaY/3;
tbMovingX = (new int[] { 1, 3, 6 }).Contains((int)_snapTypeTemp)?Math.Max(deltaX / 3, 0):tbMovingX;
tbMovingX = (new int[] { 2, 4, 5 }).Contains((int)_snapTypeTemp)?Math.Min(deltaX / 3, 0):tbMovingX;
tbMovingY = (new int[] { 1, 2, 8 }).Contains((int)_snapTypeTemp)?Math.Max(deltaY / 3, 0):tbMovingY;
tbMovingY = (new int[] { 3, 4, 7 }).Contains((int)_snapTypeTemp)?Math.Min(deltaY / 3, 0):tbMovingY;
ToolBarV2Grid.RenderTransformOrigin = new Point(
(new int[] { 1, 3, 6 }).Contains((int)_snapTypeTemp) ? 0 :
(new int[] { 7, 8 }).Contains((int)_snapTypeTemp) ? 0.5 : 1,
(new int[] { 1, 2, 8 }).Contains((int)_snapTypeTemp) ? 0 :
(new int[] { 5, 6 }).Contains((int)_snapTypeTemp) ? 0.5 : 1
);
ToolBarV2Grid.RenderTransform = new ScaleTransform(
1 + (tbMovingX /350)*((new int[] { 1, 3, 6 }).Contains((int)_snapTypeTemp)?1:(new int[] { 2, 4, 5 }).Contains((int)_snapTypeTemp)?-1:0),
1 + (tbMovingY /120)*((new int[] { 1, 2, 8 }).Contains((int)_snapTypeTemp)?1:(new int[] { 3, 4, 7 }).Contains((int)_snapTypeTemp)?-1:0));
ToolbarV2.RenderTransform = new TranslateTransform(tbMovingX, tbMovingY);
HeadIconImage.RenderTransform = new TranslateTransform(tbMovingX / 2, tbMovingY / 2);
}
}
#endregion
private CornerRadius _ltCornerRadius = new CornerRadius(0, 0, 4, 0);
private CornerRadius _lbCornerRadius = new CornerRadius(0, 4, 0, 0);
private CornerRadius _rtCornerRadius = new CornerRadius(0, 0, 0, 4);
private CornerRadius _rbCornerRadius = new CornerRadius(4, 0, 0, 0);
private CornerRadius _tsCornerRadius = new CornerRadius(0, 0, 4, 4);
private CornerRadius _bsCornerRadius = new CornerRadius(4, 4, 0, 0);
private void UpdateToolbarPlacementFeedback() {
var snapT = SnapType;
var xSideCenter = (System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
var xDeltaCenter = xSideCenter - Left;
PlaceFeedbackBorder.Width = ActualWidth - 16;
PlaceFeedbackBorder.Height = ActualHeight - 16;
PlacementFeedbackPopup.IsOpen = true;
if (Math.Abs(24 + Top) <= 24 && Math.Abs(24 + Left) <= 24) {
PlacementFeedbackPopup.VerticalOffset = 0;
PlacementFeedbackPopup.HorizontalOffset = 0;
PlaceFeedbackBorder.CornerRadius = _ltCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Bottom;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Left;
PlacementFeedbackTipText.Text = "左上角";
} else if (Math.Abs(24 + Left) <= 24 && 24 - (Top + ActualHeight - System.Windows.SystemParameters.PrimaryScreenHeight) <= 24) {
PlacementFeedbackPopup.VerticalOffset = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 16;
PlacementFeedbackPopup.HorizontalOffset = 0;
PlaceFeedbackBorder.CornerRadius = _lbCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Top;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Left;
PlacementFeedbackTipText.Text = "左下角";
} else if (24 - (Left + ActualWidth - System.Windows.SystemParameters.PrimaryScreenWidth) <= 24 && Math.Abs(24 + Top) <= 24) {
PlacementFeedbackPopup.VerticalOffset = 0;
PlacementFeedbackPopup.HorizontalOffset = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 16;
PlaceFeedbackBorder.CornerRadius = _rtCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Bottom;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Right;
PlacementFeedbackTipText.Text = "右上角";
} else if (24 - (Left + ActualWidth - System.Windows.SystemParameters.PrimaryScreenWidth) <= 24 &&
24 - (Top + ActualHeight - System.Windows.SystemParameters.PrimaryScreenHeight) <= 24) {
PlacementFeedbackPopup.VerticalOffset = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 16;
PlacementFeedbackPopup.HorizontalOffset = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 16;
PlaceFeedbackBorder.CornerRadius = _rbCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Top;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Right;
PlacementFeedbackTipText.Text = "右下角";
} else if (snapT == ToolBarSnapType.TopSide && Math.Abs(xDeltaCenter)<=50) {
PlacementFeedbackPopup.VerticalOffset = 0;
PlacementFeedbackPopup.HorizontalOffset =
(System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 16) / 2;
PlaceFeedbackBorder.CornerRadius = _tsCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Bottom;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Center;
PlacementFeedbackTipText.Text = "顶部居中";
} else if (snapT == ToolBarSnapType.BottomSide && Math.Abs(xDeltaCenter)<=90) {
PlacementFeedbackPopup.VerticalOffset = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 16;
PlacementFeedbackPopup.HorizontalOffset =
(System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 16) / 2;
PlaceFeedbackBorder.CornerRadius = _bsCornerRadius;
PlacementFeedbackTipText.VerticalAlignment = VerticalAlignment.Top;
PlacementFeedbackTipText.HorizontalAlignment = HorizontalAlignment.Center;
PlacementFeedbackTipText.Text = "底部居中";
} else {
PlacementFeedbackPopup.IsOpen = false;
}
}
public FloatingBarItem SelectedItem {
get => ToolbarItems.Single(item => item.Selected);
}
private void UseNearSnap() {
if (Math.Abs(24 + Top) <= 24 && Math.Abs(24 + Left) <= 24) {
Top = -24;
Left = -24;
} else if (
24 - (Left + ActualWidth - System.Windows.SystemParameters.PrimaryScreenWidth) <= 24 &&
Math.Abs(24 + Top) <= 24
) {
Top = -24;
Left = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24;
} else if (
Math.Abs(24 + Left) <= 24 &&
24 - (Top + ActualHeight - System.Windows.SystemParameters.PrimaryScreenHeight) <= 24
) {
Top = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24;
Left = -24;
} else if (
24 - (Left + ActualWidth - System.Windows.SystemParameters.PrimaryScreenWidth) <= 24 &&
24 - (Top + ActualHeight - System.Windows.SystemParameters.PrimaryScreenHeight) <= 24
) {
Top = System.Windows.SystemParameters.PrimaryScreenHeight - ActualHeight + 24;
Left = System.Windows.SystemParameters.PrimaryScreenWidth - ActualWidth + 24;
}
}
private void HeadIconButton_MouseUp(object sender, MouseButtonEventArgs e) {
if (_isMouseDownHeadIcon == false) return;
_isMouseDownHeadIcon = false;
var gd = sender as Grid;
gd.ReleaseMouseCapture();
gd.RenderTransform = null;
ToolbarV2.RenderTransform = null;
ToolBarV2Grid.RenderTransform = null;
HeadIconImage.RenderTransform = null;
PlacementFeedbackPopup.IsOpen = false;
UseNearSnap();
if (!isInMovingMode) {
var mp = System.Windows.Forms.Control.MousePosition;
var mpLogical = new Point(mp.X * ScalingFactor, mp.Y * ScalingFactor);
if (Math.Abs(mpLogical.X - prevPoint.X - winLeft - 24) < 2.5 || Math.Abs(mpLogical.Y - prevPoint.Y - winTop - 24) < 2.5) {
if (ToolBarNowVariantMode == 3) {
if (SelectedItem.ToolType != MainWindow.ICCToolsEnum.CursorMode)
UpdateToolBarVariant(0);
else UpdateToolBarVariant(1);
} else {
UpdateToolBarVariant(3);
}
}
}
isInMovingMode = false;
}
}
}
@@ -0,0 +1,281 @@
<Window x:Class="Ink_Canvas.Popups.ScreenshotWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d" AllowsTransparency="True" Background="Transparent"
WindowStyle="None" ResizeMode="NoResize" ShowInTaskbar="False" WindowState="Maximized"
KeyDown="ScreenshotWindow_OnKeyDown"
Title="ScreenshotWindow" Width="1920" Height="1080" Topmost="True">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<DrawingImage x:Key="LoadingBlackDrawingImage">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="#FF222222" Geometry="F1 M16,16z M0,0z M7.97866,1.05463C7.88823,1.0548 7.798,1.06331 7.70913,1.08003 4.70969,1.23997 2.08169,3.30185 1.25795,6.20893 0.49488,9.22696 1.82645,12.4419 4.50014,14.0371 7.21817,15.5554 10.6675,15.1016 12.9005,12.9316 15.0709,10.6989 15.5243,7.25016 14.006,4.5312 15.5126,7.25687 15.038,10.6938 12.8712,12.9023 10.6434,15.0497 7.21718,15.4792 4.54116,13.9668 1.92311,12.3914 0.626806,9.23612 1.36147,6.29487 0.653131,9.24292 1.98362,12.3666 4.58217,13.8964 7.23613,15.3673 10.6076,14.9008 12.756,12.7871 14.8504,10.6193 15.2698,7.25855 13.7931,4.65425 15.2461,7.27223 14.7845,10.6101 12.6974,12.7285 10.5597,14.7962 7.23254,15.2126 4.6642,13.7539 2.14585,12.2446 0.888133,9.18174 1.59975,6.35737 0.914456,9.18855 2.2044,12.2197 4.70327,13.6835 7.24954,15.1008 10.5239,14.6473 12.5822,12.6132 14.5969,10.5356 15.0033,7.27391 13.5802,4.77729 14.9796,7.28759 14.531,10.5265 12.5236,12.5546 10.476,14.5427 7.2479,14.9461 4.78725,13.541 2.36858,12.0977 1.14946,9.12542 1.83803,6.41792 1.17578,9.13222 2.42714,12.0729 4.82631,13.4706 7.26489,14.8343 10.4402,14.3938 12.4083,12.4394 14.3433,10.4519 14.7367,7.28732 13.3673,4.89839 14.713,7.301 14.2775,10.4428 12.3498,12.3808 10.3924,14.2892 7.2613,14.6796 4.90835,13.3281 2.58936,11.9509 1.41078,9.07104 2.07631,6.48042 1.43711,9.07785 2.64987,11.926 4.94936,13.2578 7.28025,14.5677 10.3565,14.1402 12.2345,12.2656 14.0898,10.3682 14.4702,7.30267 13.1544,5.02143 14.4465,7.31636 14.024,10.3591 12.1759,12.207 10.3087,14.0357 7.27666,14.413 5.03139,13.1152 2.8121,11.804 1.67015,9.01472 2.31264,6.54097 1.69648,9.02152 2.87261,11.7792 5.07241,13.0449 7.29561,14.3012 10.2728,13.8867 12.0607,12.0918 13.8363,10.2845 14.2037,7.31803 12.9415,5.14448 14.18,7.33171 13.7705,10.2754 12.0021,12.0331 10.225,13.7822 7.29202,14.1465 5.15444,12.9023 3.03484,11.6571 1.93148,8.96035 2.55092,6.60347 1.9578,8.96716 3.09535,11.6323 5.19545,12.832 7.31097,14.0347 10.1891,13.6332 11.8869,11.9179 13.5828,10.2008 13.9371,7.33339 12.7287,5.26753 13.9134,7.34707 13.5169,10.1917 11.8283,11.8593 10.1413,13.5286 7.30738,13.88 5.27749,12.6894 3.25757,11.5103 2.19281,8.90403 2.7892,6.66401 2.21913,8.91084 3.31808,11.4854 5.3185,12.6191 7.32633,13.7681 10.1054,13.3797 11.713,11.7441 13.3293,10.1171 13.6706,7.34875 12.5158,5.39057 13.6469,7.36243 13.2634,10.108 11.6544,11.6855 10.0576,13.2751 7.32273,13.6134 5.40053,12.4765 3.48031,11.3634 2.45413,8.8477 3.02749,6.72456 2.48045,8.85451 3.54082,11.3386 5.44155,12.4062 7.34168,13.5016 10.0217,13.1262 11.5392,11.5703 13.0758,10.0334 13.4041,7.3641 12.3029,5.51362 13.3804,7.37778 13.0099,10.0243 11.4806,11.5117 9.97389,13.0216 7.3381,13.3469 5.52358,12.2636 3.70304,11.2166 2.71546,8.79333 3.26577,6.78706 2.74178,8.80014 3.76355,11.1917 5.5646,12.1933 7.35705,13.2351 9.93804,12.8727 11.3654,11.3964 12.8222,9.94974 13.1375,7.37946 12.09,5.63667 13.1138,7.39314 12.7564,9.94061 11.3068,11.3378 9.8902,12.7681 7.35345,13.0804 5.64663,12.0507 3.92578,11.0697 2.97483,8.73701 3.5021,6.84761 3.00115,8.74381 3.98629,11.0449 5.68764,11.9804 7.3724,12.9685 9.85435,12.6191 11.1915,11.2226 12.5687,9.86605 12.871,7.39482 11.8771,5.75972 12.8473,7.4085 12.5029,9.85692 11.133,11.164 9.80651,12.5146 7.36881,12.8138 5.76967,11.8378 4.14852,10.9229 3.23615,8.68263 3.74038,6.91011 3.26248,8.68944 4.20903,10.898 5.81069,11.7675 7.38776,12.702 9.77065,12.3656 11.0177,11.0488 12.3152,9.78235 12.6045,7.41019 11.6642,5.88276 12.5808,7.42387 12.2494,9.77322 10.9591,10.9902 9.72281,12.2611 7.38417,12.5473 5.89272,11.6249 4.37125,10.776 3.49748,8.62631 3.97866,6.97065 3.52413,8.63319 4.43201,10.7498 5.93374,11.5527 7.40284,12.433 9.68601,12.1097 10.8419,10.873 12.0588,9.69723 12.3356,7.42595 11.4494,6.00776 12.3234,7.43297 12.0258,9.69328 10.8126,10.8437 9.66222,12.0569 7.40191,12.3545 5.9767,11.4804 4.50712,10.6832 3.63409,8.57548 4.10952,6.97261 4.49922,5.34676 6.30735,3.95946 7.97866,4.00386L7.97866,3.99994C7.97932,3.99994 7.97999,3.99994 7.98066,3.99994 8.37116,3.9997 8.74559,3.84446 9.02172,3.56834 9.29784,3.29221 9.45307,2.91778 9.45331,2.52728 9.45307,2.13679 9.29784,1.76235 9.02171,1.48623 8.74559,1.21011 8.37116,1.05487 7.98066,1.05463 7.97999,1.05463 7.97932,1.05463 7.97866,1.05463z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="LoadingWhiteDrawingImage">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V16 H16 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F1 M16,16z M0,0z M7.97866,1.05463C7.88823,1.0548 7.798,1.06331 7.70913,1.08003 4.70969,1.23997 2.08169,3.30185 1.25795,6.20893 0.49488,9.22696 1.82645,12.4419 4.50014,14.0371 7.21817,15.5554 10.6675,15.1016 12.9005,12.9316 15.0709,10.6989 15.5243,7.25016 14.006,4.5312 15.5126,7.25687 15.038,10.6938 12.8712,12.9023 10.6434,15.0497 7.21718,15.4792 4.54116,13.9668 1.92311,12.3914 0.626806,9.23612 1.36147,6.29487 0.653131,9.24292 1.98362,12.3666 4.58217,13.8964 7.23613,15.3673 10.6076,14.9008 12.756,12.7871 14.8504,10.6193 15.2698,7.25855 13.7931,4.65425 15.2461,7.27223 14.7845,10.6101 12.6974,12.7285 10.5597,14.7962 7.23254,15.2126 4.6642,13.7539 2.14585,12.2446 0.888133,9.18174 1.59975,6.35737 0.914456,9.18855 2.2044,12.2197 4.70327,13.6835 7.24954,15.1008 10.5239,14.6473 12.5822,12.6132 14.5969,10.5356 15.0033,7.27391 13.5802,4.77729 14.9796,7.28759 14.531,10.5265 12.5236,12.5546 10.476,14.5427 7.2479,14.9461 4.78725,13.541 2.36858,12.0977 1.14946,9.12542 1.83803,6.41792 1.17578,9.13222 2.42714,12.0729 4.82631,13.4706 7.26489,14.8343 10.4402,14.3938 12.4083,12.4394 14.3433,10.4519 14.7367,7.28732 13.3673,4.89839 14.713,7.301 14.2775,10.4428 12.3498,12.3808 10.3924,14.2892 7.2613,14.6796 4.90835,13.3281 2.58936,11.9509 1.41078,9.07104 2.07631,6.48042 1.43711,9.07785 2.64987,11.926 4.94936,13.2578 7.28025,14.5677 10.3565,14.1402 12.2345,12.2656 14.0898,10.3682 14.4702,7.30267 13.1544,5.02143 14.4465,7.31636 14.024,10.3591 12.1759,12.207 10.3087,14.0357 7.27666,14.413 5.03139,13.1152 2.8121,11.804 1.67015,9.01472 2.31264,6.54097 1.69648,9.02152 2.87261,11.7792 5.07241,13.0449 7.29561,14.3012 10.2728,13.8867 12.0607,12.0918 13.8363,10.2845 14.2037,7.31803 12.9415,5.14448 14.18,7.33171 13.7705,10.2754 12.0021,12.0331 10.225,13.7822 7.29202,14.1465 5.15444,12.9023 3.03484,11.6571 1.93148,8.96035 2.55092,6.60347 1.9578,8.96716 3.09535,11.6323 5.19545,12.832 7.31097,14.0347 10.1891,13.6332 11.8869,11.9179 13.5828,10.2008 13.9371,7.33339 12.7287,5.26753 13.9134,7.34707 13.5169,10.1917 11.8283,11.8593 10.1413,13.5286 7.30738,13.88 5.27749,12.6894 3.25757,11.5103 2.19281,8.90403 2.7892,6.66401 2.21913,8.91084 3.31808,11.4854 5.3185,12.6191 7.32633,13.7681 10.1054,13.3797 11.713,11.7441 13.3293,10.1171 13.6706,7.34875 12.5158,5.39057 13.6469,7.36243 13.2634,10.108 11.6544,11.6855 10.0576,13.2751 7.32273,13.6134 5.40053,12.4765 3.48031,11.3634 2.45413,8.8477 3.02749,6.72456 2.48045,8.85451 3.54082,11.3386 5.44155,12.4062 7.34168,13.5016 10.0217,13.1262 11.5392,11.5703 13.0758,10.0334 13.4041,7.3641 12.3029,5.51362 13.3804,7.37778 13.0099,10.0243 11.4806,11.5117 9.97389,13.0216 7.3381,13.3469 5.52358,12.2636 3.70304,11.2166 2.71546,8.79333 3.26577,6.78706 2.74178,8.80014 3.76355,11.1917 5.5646,12.1933 7.35705,13.2351 9.93804,12.8727 11.3654,11.3964 12.8222,9.94974 13.1375,7.37946 12.09,5.63667 13.1138,7.39314 12.7564,9.94061 11.3068,11.3378 9.8902,12.7681 7.35345,13.0804 5.64663,12.0507 3.92578,11.0697 2.97483,8.73701 3.5021,6.84761 3.00115,8.74381 3.98629,11.0449 5.68764,11.9804 7.3724,12.9685 9.85435,12.6191 11.1915,11.2226 12.5687,9.86605 12.871,7.39482 11.8771,5.75972 12.8473,7.4085 12.5029,9.85692 11.133,11.164 9.80651,12.5146 7.36881,12.8138 5.76967,11.8378 4.14852,10.9229 3.23615,8.68263 3.74038,6.91011 3.26248,8.68944 4.20903,10.898 5.81069,11.7675 7.38776,12.702 9.77065,12.3656 11.0177,11.0488 12.3152,9.78235 12.6045,7.41019 11.6642,5.88276 12.5808,7.42387 12.2494,9.77322 10.9591,10.9902 9.72281,12.2611 7.38417,12.5473 5.89272,11.6249 4.37125,10.776 3.49748,8.62631 3.97866,6.97065 3.52413,8.63319 4.43201,10.7498 5.93374,11.5527 7.40284,12.433 9.68601,12.1097 10.8419,10.873 12.0588,9.69723 12.3356,7.42595 11.4494,6.00776 12.3234,7.43297 12.0258,9.69328 10.8126,10.8437 9.66222,12.0569 7.40191,12.3545 5.9767,11.4804 4.50712,10.6832 3.63409,8.57548 4.10952,6.97261 4.49922,5.34676 6.30735,3.95946 7.97866,4.00386L7.97866,3.99994C7.97932,3.99994 7.97999,3.99994 7.98066,3.99994 8.37116,3.9997 8.74559,3.84446 9.02172,3.56834 9.29784,3.29221 9.45307,2.91778 9.45331,2.52728 9.45307,2.13679 9.29784,1.76235 9.02171,1.48623 8.74559,1.21011 8.37116,1.05487 7.98066,1.05463 7.97999,1.05463 7.97932,1.05463 7.97866,1.05463z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Window.Resources>
<Grid>
<Border Name="ScreenshotPanel" VerticalAlignment="Bottom" Height="180" Width="430" Background="#fafafa" BorderBrush="#3b82f6" BorderThickness="2" CornerRadius="24,12,24,24" Margin="0,0,0,32">
<Grid>
<Grid>
<modern:SimpleStackPanel Name="MainFuncPanel" Orientation="Vertical" Spacing="2">
<Grid Margin="13.5,16,13.5,6">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Name="FullScreenIcon" Margin="2.5,0,2.5,0" Grid.Column="0" CornerRadius="16" Background="#1618181b" Height="78">
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Width="40" Height="40">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="FullScreenIconGeometry" Brush="#18181b" Geometry="F0 M24,24z M0,0z M2.58579,3.58579C2.96086,3.21071,3.46957,3,4,3L20,3C20.5304,3 21.0391,3.21071 21.4142,3.58579 21.7893,3.96086 22,4.46957 22,5L22,15C22,15.5304 21.7893,16.0391 21.4142,16.4142 21.0391,16.7893 20.5304,17 20,17L16,17 16,19 17,19C17.5523,19 18,19.4477 18,20 18,20.5523 17.5523,21 17,21L7,21C6.44772,21 6,20.5523 6,20 6,19.4477 6.44772,19 7,19L8,19 8,17 4,17C3.46957,17 2.96086,16.7893 2.58579,16.4142 2.21071,16.0391 2,15.5304 2,15L2,5C2,4.46957,2.21071,3.96086,2.58579,3.58579z M20,5L20,15 4,15 4,5 20,5z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Name="FullScreenIconText" Text="全屏截图" FontSize="14" HorizontalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Border>
<Border Name="WindowIcon" Margin="2.5,0,2.5,0" Grid.Column="1" CornerRadius="16" Background="#1618181b" Height="78">
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Width="40" Height="40">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="WindowIconsGeometry" Brush="#18181b" Geometry="F0 M24,24z M0,0z M5,6C4.73478,6 4.48043,6.10536 4.29289,6.29289 4.10536,6.48043 4,6.73478 4,7L4,17C4,17.2652 4.10536,17.5196 4.29289,17.7071 4.48043,17.8946 4.73478,18 5,18L19,18C19.2652,18 19.5196,17.8946 19.7071,17.7071 19.8946,17.5196 20,17.2652 20,17L20,7C20,6.73478 19.8946,6.48043 19.7071,6.29289 19.5196,6.10536 19.2652,6 19,6L5,6z M2.87868,4.87868C3.44129,4.31607,4.20435,4,5,4L19,4C19.7957,4 20.5587,4.31607 21.1213,4.87868 21.6839,5.44129 22,6.20435 22,7L22,17C22,17.7957 21.6839,18.5587 21.1213,19.1213 20.5587,19.6839 19.7957,20 19,20L5,20C4.20435,20 3.44129,19.6839 2.87868,19.1213 2.31607,18.5587 2,17.7956 2,17L2,7C2,6.20435,2.31607,5.44129,2.87868,4.87868z M5,8C5,7.44772,5.44772,7,6,7L6.01,7C6.56228,7 7.01,7.44772 7.01,8 7.01,8.55228 6.56228,9 6.01,9L6,9C5.44772,9,5,8.55228,5,8z M9,7C8.44772,7 8,7.44772 8,8 8,8.55228 8.44772,9 9,9L9.01,9C9.56228,9 10.01,8.55228 10.01,8 10.01,7.44772 9.56228,7 9.01,7L9,7z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Name="WindowIconText" Text="窗口截图" FontSize="14" HorizontalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Border>
<Border Name="SelectionIcon" Margin="2.5,0,2.5,0" Grid.Column="2" CornerRadius="16" Background="#1618181b" Height="78">
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Width="40" Height="40">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="SelectionIconGeometry" Brush="#18181b" Geometry="F0 M24,24z M0,0z M10,5C9.73478,5 9.48043,5.10536 9.29289,5.29289 9.10536,5.48043 9,5.73478 9,6L9,8 9,8.08584 12.0858,5 10,5z M7,7L7,6C7,5.20435 7.31607,4.44129 7.87868,3.87868 8.44129,3.31607 9.20435,3 10,3L18,3C18.7956,3 19.5587,3.31607 20.1213,3.87868 20.6839,4.44129 21,5.20435 21,6L21,14C21,14.7957 20.6839,15.5587 20.1213,16.1213 19.5587,16.6839 18.7957,17 18,17L17,17 17,18C17,18.7957 16.6839,19.5587 16.1213,20.1213 15.5587,20.6839 14.7957,21 14,21L6,21C5.20435,21 4.44129,20.6839 3.87868,20.1213 3.31607,19.5587 3,18.7956 3,18L3,10C3,9.20435 3.31607,8.44129 3.87868,7.87868 4.44129,7.31607 5.20435,7 6,7L7,7z M15,17L15,18C15,18.2652 14.8946,18.5196 14.7071,18.7071 14.5196,18.8946 14.2652,19 14,19L6,19C5.73478,19 5.48043,18.8946 5.29289,18.7071 5.10536,18.5196 5,18.2652 5,18L5,10C5,9.73478 5.10536,9.48043 5.29289,9.29289 5.48043,9.10536 5.73478,9 6,9L7,9 7,14C7,14.7957 7.31607,15.5587 7.87868,16.1213 8.44129,16.6839 9.20435,17 10,17L13.4822,17C13.4856,17 13.4889,17.0001 13.4923,17.0001 13.4981,17.0001 13.5039,17.0001 13.5097,17L15,17z M16,15L18,15C18.2652,15 18.5196,14.8946 18.7071,14.7071 18.8946,14.5196 19,14.2652 19,14L19,11.9103 15.9103,15 16,15z M9,13.5858L9,10.9143 14.9143,5 17.5858,5 9,13.5858z M10.4142,15L19,6.41419 19,9.08185 13.0819,15 10.4142,15z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Name="SelectionIconText" Text="选区截图" FontSize="14" HorizontalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Border>
<Border Name="DesktopIcon" Margin="2.5,0,2.5,0" Grid.Column="3" CornerRadius="16" Background="#1618181b" Height="78">
<modern:SimpleStackPanel Spacing="2" Orientation="Vertical" VerticalAlignment="Center">
<Image Width="40" Height="40">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M2.58579,3.58579C2.96086,3.21071,3.46957,3,4,3L20,3C20.5304,3 21.0391,3.21071 21.4142,3.58579 21.7893,3.96086 22,4.46957 22,5L22,13C22,13.5523 21.5523,14 21,14 20.4477,14 20,13.5523 20,13L20,5 4,5 4,15 9,15 12.5,15C13.0523,15 13.5,15.4477 13.5,16 13.5,16.5523 13.0523,17 12.5,17L10,17 10,19 12.5,19C13.0523,19 13.5,19.4477 13.5,20 13.5,20.5523 13.0523,21 12.5,21L9,21 7,21C6.44772,21 6,20.5523 6,20 6,19.4477 6.44772,19 7,19L8,19 8,17 4,17C3.46957,17 2.96086,16.7893 2.58579,16.4142 2.21071,16.0391 2,15.5304 2,15L2,5C2,4.46957,2.21071,3.96086,2.58579,3.58579z M20,19.4142L16.7071,22.7071C16.3166,23.0976 15.6834,23.0976 15.2929,22.7071 14.9024,22.3166 14.9024,21.6834 15.2929,21.2929L18.5858,18 16.5,18C15.9477,18 15.5,17.5523 15.5,17 15.5,16.4477 15.9477,16 16.5,16L20.9993,16 21,16C21.001,16 21.002,16 21.003,16 21.1375,16.0004 21.2657,16.0273 21.3828,16.0759 21.5007,16.1247 21.6112,16.197 21.7071,16.2929 21.8902,16.476 21.9874,16.7123 21.9989,16.952 21.9996,16.968 22,16.984 22,17 22,17.0003 22,17.0007 22,17.001L22,21.5C22,22.0523 21.5523,22.5 21,22.5 20.4477,22.5 20,22.0523 20,21.5L20,19.4142z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Name="DesktopIconText" Text="显示桌面" FontSize="14" HorizontalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Border>
</Grid>
<Grid>
<modern:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="24">
<modern:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox MinWidth="0" Name="ToggleSwitchCopyToClipBoard" IsChecked="True" FontWeight="Bold"/>
<Image Width="18" Height="18" Margin="0,0,3,0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M4,5C4,4.45228,4.45228,4,5,4L15,4C15.1876,4 15.266,4.04268 15.3156,4.07864 15.3868,4.13032 15.4886,4.23877 15.626,4.486 15.8945,4.96868 16.5033,5.14237 16.986,4.87396 17.4687,4.60554 17.6424,3.99667 17.374,3.514 17.1694,3.14623 16.8962,2.75468 16.4904,2.46011 16.063,2.14982 15.5624,2 15,2L5,2C3.34772,2,2,3.34772,2,5L2,15 2,15.0024C2.00128,15.5315 2.1422,16.0508 2.40853,16.5079 2.67485,16.965 3.05714,17.3437 3.51674,17.6057 3.99654,17.8793 4.60722,17.7121 4.88075,17.2323 5.15427,16.7525 4.98705,16.1418 4.50726,15.8683 4.35355,15.7806 4.2257,15.654 4.13662,15.5011 4.04772,15.3485 4.0006,15.1752 4,14.9986L4,5z M8.48825,8.48825C8.80088,8.17563,9.22488,8,9.667,8L18.333,8C18.5519,8 18.7687,8.04312 18.9709,8.12689 19.1732,8.21067 19.357,8.33346 19.5117,8.48825 19.6665,8.64305 19.7893,8.82682 19.8731,9.02907 19.9569,9.23132 20,9.44808 20,9.667L20,18.333C20,18.5519 19.9569,18.7687 19.8731,18.9709 19.7893,19.1732 19.6665,19.3569 19.5117,19.5117 19.3569,19.6665 19.1732,19.7893 18.9709,19.8731 18.7687,19.9569 18.5519,20 18.333,20L9.667,20C9.44808,20 9.23132,19.9569 9.02907,19.8731 8.82682,19.7893 8.64305,19.6665 8.48825,19.5117 8.33346,19.357 8.21067,19.1732 8.12689,18.9709 8.04312,18.7687 8,18.5519 8,18.333L8,9.667C8,9.22488,8.17563,8.80088,8.48825,8.48825z M9.667,6C8.69445,6 7.76174,6.38634 7.07404,7.07404 6.38634,7.76174 6,8.69445 6,9.667L6,18.333C6,18.8146 6.09485,19.2914 6.27913,19.7363 6.46342,20.1812 6.73353,20.5854 7.07404,20.926 7.41455,21.2665 7.8188,21.5366 8.2637,21.7209 8.7086,21.9052 9.18544,22 9.667,22L18.333,22C18.8146,22 19.2914,21.9052 19.7363,21.7209 20.1812,21.5366 20.5854,21.2665 20.926,20.926 21.2665,20.5854 21.5366,20.1812 21.7209,19.7363 21.9052,19.2914 22,18.8146 22,18.333L22,9.667C22,9.18544 21.9052,8.7086 21.7209,8.2637 21.5366,7.8188 21.2665,7.41455 20.926,7.07404 20.5854,6.73353 20.1812,6.46342 19.7363,6.27913 19.2914,6.09485 18.8146,6 18.333,6L9.667,6z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#18181b" Text="复制到剪贴板" VerticalAlignment="Center"
FontSize="14" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<CheckBox MinWidth="0" Name="ToggleSwitchAttachInk" IsChecked="True"
FontFamily="Microsoft YaHei UI" FontWeight="Bold"/>
<Image Width="18" Height="18" Margin="0,0,3,0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M18.0959,19.9954C18.1916,19.9863,18.2834,19.9638,18.3693,19.9296L18.0959,19.9954z" />
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M18,2C16.3267,2,15,3.32672,15,5L15,7 15,17C15,17.2652,15.1054,17.5196,15.2929,17.7071L15.5858,18 5,18C4.73478,18 4.48043,17.8946 4.29289,17.7071 4.10536,17.5196 4,17.2652 4,17 4,16.7348 4.10536,16.4804 4.29289,16.2929 4.48043,16.1054 4.73478,16 5,16L9,16C9.79565,16 10.5587,15.6839 11.1213,15.1213 11.6839,14.5587 12,13.7957 12,13 12,12.2043 11.6839,11.4413 11.1213,10.8787 10.5587,10.3161 9.79565,10 9,10L6,10C5.44772,10 5,10.4477 5,11 5,11.5523 5.44772,12 6,12L9,12C9.26522,12 9.51957,12.1054 9.70711,12.2929 9.89464,12.4804 10,12.7348 10,13 10,13.2652 9.89464,13.5196 9.70711,13.7071 9.51957,13.8946 9.26522,14 9,14L5,14C4.20435,14 3.44129,14.3161 2.87868,14.8787 2.31607,15.4413 2,16.2044 2,17 2,17.7956 2.31607,18.5587 2.87868,19.1213 3.44129,19.6839 4.20435,20 5,20L18,20C18.0171,20 18.0341,19.9996 18.051,19.9987 18.0659,19.9979 18.0809,19.9969 18.0959,19.9954L18.3693,19.9296C18.4923,19.8808,18.6076,19.8066,18.7071,19.7071L20.7071,17.7071C20.8946,17.5196,21,17.2652,21,17L21,5C21,3.32672,19.6733,2,18,2z M18,4C17.4313,4,17,4.43128,17,5L17,6 19,6 19,5C19,4.43128,18.5687,4,18,4z M17,16.5858L18,17.5858 19,16.5858 19,8 17,8 17,16.5858z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#18181b" Text="附带批注墨迹" VerticalAlignment="Center"
FontSize="14" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</modern:SimpleStackPanel>
<Border Padding="0,0,0,24" CornerRadius="24" Background="#88FFFFFF" Name="LoadingOverlay" Visibility="Collapsed">
<modern:SimpleStackPanel RenderTransformOrigin="0.5,0.5" Orientation="Vertical" Spacing="8" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="32" Height="32" Source="{StaticResource LoadingBlackDrawingImage}">
<Image.RenderTransform>
<RotateTransform CenterX="16" CenterY="16" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
To="360" Duration="0:0:1.5" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<TextBlock FontSize="14" Foreground="#1b1b1f" VerticalAlignment="Center" Text="截图中..."></TextBlock>
</modern:SimpleStackPanel>
</Border>
</Grid>
<Border VerticalAlignment="Bottom" Height="34" CornerRadius="0,0,24,24" Background="#f4f4f5" BorderBrush="#d4d4d8" BorderThickness="0,1,0,0" Padding="24,0">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Width="230">
<TextBlock VerticalAlignment="Center" FontSize="12" Foreground="#52525b" TextTrimming="CharacterEllipsis" Text="Screenshot-2024-01-02-23-45-12.png"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center" FontSize="12" Foreground="#52525b" Margin="0,-0.5,4,0" FontWeight="Bold" Text="保存路径: "/>
<Image Width="16" Height="16" VerticalAlignment="Center" Source="../Resources/Icons-png/classic-icons/desktop-small-icon.png"></Image>
<TextBlock VerticalAlignment="Center" FontSize="12" Foreground="#52525b" Margin="4,-0.5,0,0" Text="桌面"/>
</StackPanel>
</Grid>
</Border>
<Border MouseDown="CloseButton_CloseWindow" Margin="-16" BorderBrush="#2563eb" BorderThickness="1" Width="32" Height="32" CornerRadius="16" Background="#3b82f6" HorizontalAlignment="Right" VerticalAlignment="Top">
<Image Height="21" Width="21">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M18.7071,6.70711C19.0976,6.31658 19.0976,5.68342 18.7071,5.29289 18.3166,4.90237 17.6834,4.90237 17.2929,5.29289L12,10.5858 6.70711,5.29289C6.31658,4.90237 5.68342,4.90237 5.29289,5.29289 4.90237,5.68342 4.90237,6.31658 5.29289,6.70711L10.5858,12 5.29289,17.2929C4.90237,17.6834 4.90237,18.3166 5.29289,18.7071 5.68342,19.0976 6.31658,19.0976 6.70711,18.7071L12,13.4142 17.2929,18.7071C17.6834,19.0976 18.3166,19.0976 18.7071,18.7071 19.0976,18.3166 19.0976,17.6834 18.7071,17.2929L13.4142,12 18.7071,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
</Grid>
</Border>
<Border Name="WindowScreenshotOverlay" Background="#dd09090b" Visibility="Collapsed">
<Grid>
<modern:SimpleStackPanel Margin="48,36" Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBlock Text="窗口截图" FontWeight="Bold" Foreground="White" FontSize="48"/>
<TextBlock Text="点击需要截取的窗口即可截图" Margin="0,8,0,0" Foreground="#d4d4d8" FontSize="18"/>
<StackPanel Name="NeedAdminTextPanel" Orientation="Horizontal" Margin="0,8,0,0">
<Image VerticalAlignment="Center" Width="26" Height="26" Source="../Resources/Icons-png/uac_icon.png"/>
<TextBlock FontWeight="Bold" VerticalAlignment="Center" Text="您当前未以管理员权限运行 icc ,这会导致部分以管理员权限运行的程序窗口无法被截取" Margin="6,0,0,0" Foreground="White" FontSize="18"/>
</StackPanel>
</modern:SimpleStackPanel>
<Grid Name="WindowScreenshotWindowsGrid">
<modern:ScrollViewerEx Name="WindowsItemsScrollViewer" PreviewMouseWheel="WindowsItemsScrollViewer_PreviewMouseWheel" IsManipulationEnabled="True" VerticalScrollBarVisibility="Hidden" Margin="36,178,36,0">
<ItemsControl Name="WindowsItemsControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="0,0,0,56" Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<modern:SimpleStackPanel Visibility="{Binding Visibility}" Width="{Binding Width}" Tag="{Binding}" Orientation="Vertical" Margin="14">
<Grid Height="24">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0">
<Image Width="24" Height="24" Source="{Binding Icon}"/>
<TextBlock Foreground="White" Width="{Binding TextBlockWidth}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="8,0,0,0" FontSize="17" Text="{Binding Title}"/>
</StackPanel>
</Grid>
<Grid Margin="0,6,0,0">
<Image Height="226" Source="{Binding Snapshot}"/>
<Border BorderBrush="#991b1b" BorderThickness="2" Background="#18181b" Visibility="{Binding ShouldDisplayFailedBorder}" Height="226" Width="{Binding Width}">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image HorizontalAlignment="Center" Height="32" Width="32" Source="../Resources/Icons-png/uac_icon.png"/>
<TextBlock HorizontalAlignment="Center" Foreground="White" FontWeight="Bold" FontSize="18" Margin="0,6,0,0">无法截取</TextBlock>
<TextBlock HorizontalAlignment="Center" Foreground="#d4d4d8" FontSize="14" Margin="0,6,0,0">ICC的权限不足</TextBlock>
</StackPanel>
</Border>
</Grid>
</modern:SimpleStackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</modern:ScrollViewerEx>
</Grid>
<Border Padding="0,0,0,24" CornerRadius="24" Background="#8809090b" Name="WindowsSnapshotLoadingOverlay" Visibility="Collapsed">
<modern:SimpleStackPanel RenderTransformOrigin="0.5,0.5" Orientation="Vertical" Spacing="8" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Width="32" Height="32" Source="{StaticResource LoadingWhiteDrawingImage}">
<Image.RenderTransform>
<RotateTransform CenterX="16" CenterY="16" />
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Image.RenderTransform).(RotateTransform.Angle)"
To="360" Duration="0:0:1.5" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<TextBlock FontSize="14" Foreground="White" VerticalAlignment="Center" Text="加载中..."></TextBlock>
</modern:SimpleStackPanel>
</Border>
<Border Padding="16,0" Height="56" VerticalAlignment="Bottom" Background="#18181b" BorderBrush="#3f3f46" BorderThickness="0,2,0,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="48">
<Border Name="EscBorder" Padding="12,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="10" Height="56">
<Image Height="28" VerticalAlignment="Center">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V33 H79 V0 H0 Z">
<GeometryDrawing Brush="#FFFFFFFF" Geometry="F0 M79,33z M0,0z M16.6025,0.119141C7.76598,0.119141 0.602539,7.28258 0.602539,16.1191 0.602539,24.9557 7.76598,32.1191 16.6025,32.1191L62.6025,32.1191C71.4391,32.1191 78.6025,24.9557 78.6025,16.1191 78.6025,7.28258 71.4391,0.119141 62.6025,0.119141L16.6025,0.119141z M39.1369,7.52734C39.9529,7.52734 40.8409,7.57534 41.8009,7.67134 42.7609,7.75134 43.6969,7.92734 44.6089,8.19934L44.3689,10.6233C43.6649,10.6073 42.8409,10.5913 41.8969,10.5753 40.9529,10.5593 40.0249,10.5513 39.1129,10.5513 38.6649,10.5513 38.2809,10.5673 37.9609,10.5993 37.6569,10.6153 37.4089,10.6793 37.2169,10.7913 37.0249,10.8873 36.8889,11.0393 36.8089,11.2473 36.7289,11.4553 36.6889,11.7433 36.6889,12.1113 36.6889,12.6713 36.8169,13.0793 37.0729,13.3353 37.3449,13.5913 37.8009,13.8233 38.4409,14.0313L41.6329,15.0633C42.9609,15.5113 43.8809,16.1193 44.3929,16.8873 44.9049,17.6553 45.1609,18.6633 45.1609,19.9113 45.1609,20.8553 45.0489,21.6393 44.8249,22.2633 44.6009,22.8873 44.2489,23.3753 43.7689,23.7273 43.2889,24.0793 42.6569,24.3273 41.8729,24.4713 41.0889,24.6313 40.1289,24.7113 38.9929,24.7113 38.4489,24.7113 37.6729,24.6713 36.6649,24.5913 35.6569,24.5273 34.5049,24.3513 33.2089,24.0633L33.4489,21.4713C34.3929,21.4873 35.2089,21.5113 35.8969,21.5433 36.6009,21.5593 37.2009,21.5753 37.6969,21.5913L38.9929,21.5913C39.6329,21.5913 40.1289,21.5513 40.4809,21.4713 40.8489,21.3913 41.1049,21.2313 41.2489,20.9913 41.3929,20.7513 41.4649,20.4073 41.4649,19.9593 41.4649,19.5753 41.4089,19.2713 41.2969,19.0473 41.2009,18.8073 41.0329,18.6233 40.7929,18.4953 40.5689,18.3513 40.2569,18.2233 39.8569,18.1113L36.4969,16.9593C35.2329,16.4953 34.3369,15.8873 33.8089,15.1353 33.2809,14.3833 33.0169,13.3913 33.0169,12.1593 33.0169,11.1993 33.1289,10.4233 33.3529,9.83134 33.5929,9.22334 33.9529,8.75134 34.4329,8.41534 34.9289,8.07934 35.5609,7.84734 36.3289,7.71934 37.1129,7.59134 38.0489,7.52734 39.1369,7.52734z M23.1979,7.76734C24.0939,7.76734 24.9979,7.77534 25.9099,7.79134 26.8219,7.79134 27.7179,7.80734 28.5979,7.83934 29.4779,7.87134 30.3019,7.92734 31.0699,8.00734L30.9019,10.6713 24.5419,10.6713C24.1419,10.6713 23.8379,10.7753 23.6299,10.9833 23.4379,11.1913 23.3419,11.4953 23.3419,11.8953L23.3419,14.4873 30.0139,14.4873 30.0139,17.0793 23.3419,17.0793 23.3419,20.3433C23.3419,20.7433 23.4379,21.0473 23.6299,21.2553 23.8379,21.4633 24.1419,21.5673 24.5419,21.5673L30.9019,21.5673 31.0699,24.2313C30.3019,24.2953 29.4779,24.3513 28.5979,24.3993 27.7179,24.4313 26.8219,24.4473 25.9099,24.4473 24.9979,24.4633 24.0939,24.4713 23.1979,24.4713 22.1419,24.4713 21.2859,24.1673 20.6299,23.5593 19.9899,22.9353 19.6699,22.1273 19.6699,21.1353L19.6699,11.1033C19.6699,10.0953 19.9899,9.28734 20.6299,8.67934 21.2859,8.07134 22.1419,7.76734 23.1979,7.76734z M56.1994,7.62334C55.6554,7.57534 54.9914,7.55134 54.2074,7.55134 52.4954,7.55134 51.1194,7.83134 50.0794,8.39134 49.0554,8.93534 48.3114,9.83134 47.8474,11.0793 47.3994,12.3273 47.1754,14.0073 47.1754,16.1193 47.1754,18.2313 47.3994,19.9113 47.8474,21.1593 48.3114,22.4073 49.0554,23.3113 50.0794,23.8713 51.1194,24.4153 52.4954,24.6873 54.2074,24.6873 55.3914,24.6873 56.3834,24.6313 57.1834,24.5193 57.9834,24.4233 58.7674,24.2553 59.5354,24.0153L59.2234,21.3273C58.4874,21.4073 57.7434,21.4633 56.9914,21.4953 56.2394,21.5273 55.3114,21.5433 54.2074,21.5433 53.3914,21.5433 52.7514,21.3833 52.2874,21.0633 51.8394,20.7433 51.5194,20.1913 51.3274,19.4073 51.1354,18.6073 51.0394,17.5113 51.0394,16.1193 51.0394,14.7273 51.1354,13.6393 51.3274,12.8553 51.5194,12.0553 51.8394,11.4953 52.2874,11.1753 52.7514,10.8553 53.3914,10.6953 54.2074,10.6953 54.9114,10.6953 55.5114,10.7033 56.0074,10.7193 56.5194,10.7193 56.9914,10.7273 57.4234,10.7433 57.8714,10.7593 58.3594,10.7833 58.8874,10.8153L59.1754,8.12734C58.6794,7.98334 58.1994,7.87134 57.7354,7.79134 57.2714,7.71134 56.7594,7.65534 56.1994,7.62334z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock FontSize="18" Foreground="White" VerticalAlignment="Center" Text="退出窗口截图"/>
</modern:SimpleStackPanel>
</Border>
</modern:SimpleStackPanel>
</Border>
</Grid>
</Border>
</Grid>
</Window>
@@ -0,0 +1,400 @@
using Ink_Canvas.Helpers;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Shell;
using System.Xml.Linq;
using OSVersionExtension;
using Vanara.PInvoke;
using Color = System.Windows.Media.Color;
using Shell32;
using static Ink_Canvas.MainWindow;
using OperatingSystem = OSVersionExtension.OperatingSystem;
namespace Ink_Canvas.Popups
{
/// <summary>
/// ScreenshotWindow.xaml 的交互逻辑
/// </summary>
public partial class ScreenshotWindow : Window {
private MainWindow mainWindow;
private Settings settings;
public ScreenshotWindow(MainWindow mainWin, Settings s) {
InitializeComponent();
mainWindow = mainWin;
settings = s;
iconList = new Border[] {
FullScreenIcon,
WindowIcon,
SelectionIcon,
DesktopIcon
};
WindowIcon.IsHitTestVisible = OSVersion.GetOperatingSystem() >= OperatingSystem.Windows10;
WindowIcon.Opacity = OSVersion.GetOperatingSystem() >= OperatingSystem.Windows10 ? 1 : 0.5;
foreach (var b in iconList) {
b.MouseLeave += IconMouseLeave;
b.MouseUp += IconMouseUp;
b.MouseDown += IconMouseDown;
b.Background = new SolidColorBrush(Colors.Transparent);
}
ReArrangeWindowPosition();
mainWin.Hide();
if (DwmCompositionHelper.DwmIsCompositionEnabled()) {
AllowsTransparency = false;
Background = new SolidColorBrush(Colors.Transparent);
WindowChrome.SetWindowChrome(this, new WindowChrome() {
GlassFrameThickness = new Thickness(-1),
CaptionHeight = 0,
CornerRadius = new CornerRadius(0),
ResizeBorderThickness = new Thickness(0),
});
} else {
AllowsTransparency = true;
Background = new SolidColorBrush(Color.FromArgb(1,0,0,0));
}
ToggleSwitchCopyToClipBoard.IsChecked = settings.Snapshot.CopyScreenshotToClipboard;
ToggleSwitchAttachInk.IsChecked = settings.Snapshot.AttachInkWhenScreenshot;
ToggleSwitchCopyToClipBoard.Checked += ToggleSwitchCopyToClipBoard_CheckChanged;
ToggleSwitchCopyToClipBoard.Unchecked += ToggleSwitchCopyToClipBoard_CheckChanged;
ToggleSwitchAttachInk.Checked += ToggleSwitchAttachInk_CheckChanged;
ToggleSwitchAttachInk.Unchecked += ToggleSwitchAttachInk_CheckChanged;
WindowsItemsControl.ItemsSource = _winInfos;
WindowScreenshotOverlay.Visibility = Visibility.Collapsed;
WindowsSnapshotLoadingOverlay.Visibility = Visibility.Collapsed;
EscBorder.MouseDown += EscBorder_MouseDown;
EscBorder.MouseUp += EscBorder_MouseUp;
EscBorder.MouseLeave += EscBorder_MouseLeave;
var identity = WindowsIdentity.GetCurrent();
var principal = new WindowsPrincipal(identity);
NeedAdminTextPanel.Visibility = principal.IsInRole(WindowsBuiltInRole.Administrator) ? Visibility.Collapsed : Visibility.Visible;
if (principal.IsInRole(WindowsBuiltInRole.Administrator)) {
WindowsItemsScrollViewer.Margin = new Thickness(36, 148, 36, 0);
} else {
WindowsItemsScrollViewer.Margin = new Thickness(36, 178, 36, 0);
}
}
private bool isEscBorderDown = false;
private void EscBorder_MouseLeave(object sender, MouseEventArgs e) {
if (!isEscBorderDown) return;
isEscBorderDown = false;
EscBorder.Background = new SolidColorBrush(Colors.Transparent);
}
private void EscBorder_MouseUp(object sender, MouseButtonEventArgs e) {
if (!isEscBorderDown) return;
if (isWindowsSnapshotLoaded == false) return;
EscBorder_MouseLeave(null, null);
ScreenshotPanel.Visibility = Visibility.Visible;
WindowScreenshotOverlay.Visibility = Visibility.Collapsed;
_winInfos.Clear();
isWindowsSnapshotLoaded = null;
}
private void EscBorder_MouseDown(object sender, MouseButtonEventArgs e) {
if (isEscBorderDown) return;
isEscBorderDown = true;
EscBorder.Background = new SolidColorBrush(Color.FromRgb(39, 39, 42));
}
private ObservableCollection<WinInfo> _winInfos = new ObservableCollection<WinInfo>();
private bool AllOneColor(Bitmap bmp)
{
// Lock the bitmap's bits.
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height);
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, bmp.PixelFormat);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
int bytes = bmpData.Stride * bmp.Height;
byte[] rgbValues = new byte[bytes];
// Copy the RGB values into the array.
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
bool AllOneColor = true;
for (int index = 0; index < rgbValues.Length; index++) {
//compare the current A or R or G or B with the A or R or G or B at position 0,0.
if (rgbValues[index] != rgbValues[index % 4]) {
AllOneColor= false;
break;
}
}
// Unlock the bits.
bmp.UnlockBits(bmpData);
return AllOneColor;
}
private async Task<bool> AllOneColorAsync(Bitmap bmp) {
var result = await Task.Run(() => AllOneColor(bmp));
return result;
}
public BitmapImage BitmapToImageSource(Bitmap bitmap)
{
using (MemoryStream memory = new MemoryStream())
{
bitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp);
memory.Position = 0;
BitmapImage bitmapimage = new BitmapImage();
bitmapimage.BeginInit();
bitmapimage.StreamSource = memory;
bitmapimage.CacheOption = BitmapCacheOption.OnLoad;
bitmapimage.EndInit();
return bitmapimage;
}
}
private static ImageSource IconToImageSource(Icon icon)
{
ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
icon.Handle,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
return imageSource;
}
private class WinInfo {
public string Title { get; set; }
public BitmapImage Snapshot { get; set; }
public ImageSource Icon { get; set; }
public HWND Handle { get; set; }
public Bitmap OriginBitmap { get; set; }
public double Width { get; set; }
public double TextBlockWidth { get; set; }
public bool IsAllOneColor { get; set; }
public bool IsDisplayFailedBorder { get; set; }
public Visibility ShouldDisplayFailedBorder {
get => IsDisplayFailedBorder ? Visibility.Visible : Visibility.Collapsed;
}
public bool IsHidden { get; set; }
public Visibility Visibility {
get => IsHidden ? Visibility.Collapsed : Visibility.Visible;
}
}
private Border lastDownIcon;
private void ToggleSwitchCopyToClipBoard_CheckChanged(object sender, RoutedEventArgs e) {
if (!mainWindow.isLoaded) return;
mainWindow.ToggleSwitchCopyScreenshotToClipboard.IsOn = ToggleSwitchCopyToClipBoard.IsChecked ?? true;
}
private void ToggleSwitchAttachInk_CheckChanged(object sender, RoutedEventArgs e) {
if (!mainWindow.isLoaded) return;
mainWindow.ToggleSwitchAttachInkWhenScreenshot.IsOn = ToggleSwitchAttachInk.IsChecked ?? true;
}
private void ReArrangeWindowPosition() {
var workAreaWidth = SystemParameters.WorkArea.Width;
var workAreaHeight = SystemParameters.WorkArea.Height;
var toolbarHeight = SystemParameters.PrimaryScreenHeight - SystemParameters.FullPrimaryScreenHeight -
SystemParameters.WindowCaptionHeight;
Left = (workAreaWidth - Width) / 2;
Top = workAreaHeight - Height - toolbarHeight - 64;
}
private bool isCaptureButtonDown = false;
private async void CaptureFullScreen() {
LoadingOverlay.Visibility = Visibility.Visible;
MainFuncPanel.Effect = new BlurEffect() {
KernelType = KernelType.Gaussian,
Radius = 24,
RenderingBias = RenderingBias.Performance,
};
try {
var bm = await mainWindow.FullscreenSnapshot(new MainWindow.SnapshotConfig() {
BitmapSavePath =
new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)),
ExcludedHwnds = new HWND[] {
new HWND(new WindowInteropHelper(this).Handle)
},
IsCopyToClipboard = settings.Snapshot.CopyScreenshotToClipboard,
IsSaveToLocal = true,
OutputMIMEType = MainWindow.OutputImageMIMEFormat.Png,
});
bm.Dispose();
LoadingOverlay.Visibility = Visibility.Collapsed;
MainFuncPanel.Effect = null;
mainWindow.ShowNewToast("已保存截图到桌面!", MW_Toast.ToastType.Success, 3000);
await Task.Delay(1);
Close();
}
catch (Exception e) {
LoadingOverlay.Visibility = Visibility.Collapsed;
MainFuncPanel.Effect = null;
mainWindow.ShowNewToast($"截图失败!{e.Message}", MW_Toast.ToastType.Error, 3000);
await Task.Delay(1);
Close();
}
}
private void IconMouseLeave(object sender, MouseEventArgs e) {
if (lastDownIcon == null) return;
lastDownIcon = null;
var b = (Border)sender;
b.Background = new SolidColorBrush(Colors.Transparent);
}
private void IconMouseDown(object sender, MouseButtonEventArgs e) {
if (lastDownIcon != null) return;
lastDownIcon = (Border)sender;
var b = (Border)sender;
b.Background = new SolidColorBrush(Color.FromArgb(22, 24, 24, 27));
}
private bool? isWindowsSnapshotLoaded = false;
private async void IconMouseUp(object sender, MouseButtonEventArgs e) {
if (lastDownIcon == null) return;
IconMouseLeave(sender, null);
/*if (selectedMode == 1) {
try {
MainWindow.WindowInformation[] windows = await mainWindow.GetAllWindowsAsync(new HWND[] {
new HWND(new WindowInteropHelper(this).Handle), new HWND(new WindowInteropHelper(mainWindow).Handle)
});
_screenshotGridWindow = new WindowScreenshotGridWindow(windows, mainWindow);
_screenshotGridWindow.Show();
}
catch (TaskCanceledException) {}
catch (Exception ex) {}
} else {
try {
_screenshotGridWindow.Close();
} catch (Exception ex) { }
}*/
if (Array.IndexOf(iconList, (Border)sender) == 0) {
CaptureFullScreen();
} else if (Array.IndexOf(iconList, (Border)sender) == 3) {
Shell shellObject = new Shell();
shellObject.ToggleDesktop();
} else if (Array.IndexOf(iconList, ((Border)sender)) == 1) {
isWindowsSnapshotLoaded = false;
await Dispatcher.InvokeAsync(() => {
_winInfos.Clear();
ScreenshotPanel.Visibility = Visibility.Collapsed;
WindowScreenshotOverlay.Visibility = Visibility.Visible;
WindowsSnapshotLoadingOverlay.Visibility = Visibility.Visible;
WindowScreenshotWindowsGrid.Effect = new BlurEffect() {
KernelType = KernelType.Gaussian,
RenderingBias = RenderingBias.Performance,
Radius = 32,
};
});
var wins = await mainWindow.GetAllWindowsAsync(new HWND[] {
new HWND(new WindowInteropHelper(this).Handle)
});
foreach (var windowInformation in wins) {
var bitmapHeight = windowInformation.WindowBitmap.Height;
var w = windowInformation.WindowBitmap.Width * (226D / bitmapHeight);
var allonecolor = await AllOneColorAsync(windowInformation.WindowBitmap);
_winInfos.Add(new WinInfo() {
Title = windowInformation.Title,
Snapshot = BitmapToImageSource(windowInformation.WindowBitmap.Clone(windowInformation.ContentRect,windowInformation.WindowBitmap.PixelFormat)),
Handle = windowInformation.hwnd,
OriginBitmap = windowInformation.WindowBitmap,
Icon = windowInformation.AppIcon == null ? new BitmapImage(new Uri("pack://application:,,,/Resources/Icons-png/classic-icons/program-icon.png")) : IconToImageSource(windowInformation.AppIcon),
Width = w,
TextBlockWidth = w - 48 - 8,
IsAllOneColor = allonecolor,
IsDisplayFailedBorder = allonecolor,
IsHidden = settings.Snapshot.OnlySnapshotMaximizeWindow,
});
if (Array.IndexOf(wins, windowInformation)>= wins.Length - 1) Dispatcher.InvokeAsync(() => {
WindowScreenshotWindowsGrid.Effect = null;
WindowsSnapshotLoadingOverlay.Visibility = Visibility.Collapsed;});
}
Dispatcher.InvokeAsync(() => {
WindowScreenshotWindowsGrid.Effect = null;
WindowsSnapshotLoadingOverlay.Visibility = Visibility.Collapsed;});
isWindowsSnapshotLoaded = true;
}
}
private Border[] iconList = new Border[] { };
private void CloseButton_CloseWindow(object sender, MouseButtonEventArgs e) {
Close();
}
protected override void OnClosed(EventArgs e) {
mainWindow.Show();
base.OnClosed(e);
}
private void ScreenshotWindow_OnKeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Escape) {
if (isWindowsSnapshotLoaded==false) return;
ScreenshotPanel.Visibility = Visibility.Visible;
WindowScreenshotOverlay.Visibility = Visibility.Collapsed;
_winInfos.Clear();
isWindowsSnapshotLoaded = null;
}
}
public void WindowsItemsScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) {
var scrollViewer = (ScrollViewer)sender;
var sb = new Storyboard();
var ofs = scrollViewer.VerticalOffset;
var animation = new DoubleAnimation
{
From = ofs,
To = ofs - e.Delta * 2.5,
Duration = TimeSpan.FromMilliseconds(155)
};
animation.EasingFunction = new CubicEase() {
EasingMode = EasingMode.EaseOut,
};
Storyboard.SetTargetProperty(animation, new PropertyPath(ColorPalette.ScrollViewerBehavior.VerticalOffsetProperty));
Storyboard.SetTargetName(animation,"WindowsItemsScrollViewer");
sb.Children.Add(animation);
scrollViewer.ScrollToVerticalOffset(ofs);
sb.Begin(scrollViewer);
}
}
}
@@ -0,0 +1,183 @@
<UserControl x:Class="Ink_Canvas.Popups.SelectionPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d" Width="300" Height="209" UseLayoutRounding="True">
<Grid>
<Border Margin="8" Background="#f4f4f5" BorderBrush="#3b82f6" BorderThickness="2" CornerRadius="6">
<Border.Effect>
<DropShadowEffect BlurRadius="5" Opacity="0.2" />
</Border.Effect>
<Grid>
<modern:SimpleStackPanel Spacing="4" Margin="8,0" Height="40" VerticalAlignment="Top" Orientation="Horizontal">
<Border x:Name="LassoTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="96"
CornerRadius="6" MouseDown="SelectionModeTabButton_MouseDown">
<Grid>
<modern:SimpleStackPanel
x:Name="LassoTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="LassoTabButtonIcon" Brush="#2563eb" Geometry="F0 M24,24z M0,0z M3.98316,13.1776C3.35263,12.2377 3.00974,11.1318 3.00003,9.99608 3.00274,6.3269 6.81405,3 12,3 17.1827,3 20.9924,6.32263 21,9.98902 20.9861,10.5697 20.8906,11.1456 20.7162,11.6997 20.5503,12.2265 20.843,12.788 21.3698,12.9539 21.8966,13.1197 22.4581,12.8271 22.6239,12.3003 22.8561,11.5624 22.9827,10.7954 22.9998,10.0221L23,10C23,4.83074 17.8522,1 12,1 6.14786,1 1.00003,4.83074 1.00003,10L1,10 1.00006,10.0079C1.01259,11.6014 1.51288,13.1514 2.43137,14.4502 2.1515,14.914 2.00003,15.4492 2.00003,16 2.00003,16.7956 2.3161,17.5587 2.87871,18.1213 3.21344,18.456 3.61912,18.7035 4.06041,18.8491 4.15138,19.4855 4.34432,20.105 4.63347,20.6833 5.05003,21.5164 5.65485,22.2411 6.40003,22.8 6.84186,23.1314 7.46866,23.0418 7.80003,22.6 8.1314,22.1582 8.04186,21.5314 7.60003,21.2 7.10325,20.8274 6.70003,20.3443 6.42232,19.7889 6.26497,19.4742 6.15036,19.1411 6.08057,18.7986 6.46727,18.6493 6.82258,18.4201 7.12135,18.1213 7.13419,18.1085 7.1469,18.0955 7.15948,18.0825 8.01906,18.4228 8.91036,18.6755 9.82719,18.8268 10.3721,18.9168 10.8867,18.5479 10.9767,18.003 11.0666,17.4581 10.6978,16.9435 10.1529,16.8535 9.4167,16.732 8.69395,16.5316 7.98881,16.2593 7.99626,16.1734 8.00003,16.0869 8.00003,16 8.00003,15.2044 7.68396,14.4413 7.12135,13.8787 6.55874,13.3161 5.79568,13 5.00003,13 4.65,13 4.30628,13.0612 3.98316,13.1776z M5.00003,17C5.26525,17 5.5196,16.8946 5.70714,16.7071 5.89467,16.5196 6.00003,16.2652 6.00003,16 6.00003,15.7348 5.89467,15.4804 5.70714,15.2929 5.5196,15.1054 5.26525,15 5.00003,15 4.73481,15 4.48046,15.1054 4.29292,15.2929 4.10539,15.4804 4.00003,15.7348 4.00003,16 4.00003,16.2652 4.10539,16.5196 4.29292,16.7071 4.48046,16.8946 4.73481,17 5.00003,17z M14.33,10.3398C14.6781,10.3398,14.9666,10.4752,15.1755,10.6477L22.5072,16.6409C22.7213,16.8121 22.8775,17.0452 22.954,17.3087 23.032,17.5769 23.0235,17.8628 22.9299,18.1259 22.8362,18.389 22.6621,18.616 22.4323,18.7746 22.2062,18.9306 21.9375,19.0127 21.6631,19.0098L17.7148,19.0098 15.4417,22.415C15.4316,22.4303 15.421,22.4452 15.41,22.4598 15.2843,22.6275 15.1212,22.7636 14.9338,22.8573 14.7463,22.951 14.5396,22.9998 14.33,22.9998L14.24,22.9998C14.1335,22.9998 14.0276,22.9828 13.9264,22.9494 13.6644,22.8629 13.4353,22.6982 13.2698,22.4775 13.1043,22.2568 13.0104,21.9908 13.0007,21.7151 13.0002,21.7033 13,21.6916 13,21.6798L13,11.6803 13,11.6798C13,11.3313 13.1357,10.9965 13.3785,10.7464 13.6213,10.4962 13.9521,10.3505 14.3006,10.3403 14.3104,10.34 14.3202,10.3398 14.33,10.3398z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="LassoTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="套索选择" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
<Border x:Name="RectangleTabButton" VerticalAlignment="Bottom"
Background="#223b82f6" Height="34" Width="96"
CornerRadius="6" MouseDown="SelectionModeTabButton_MouseDown">
<Grid>
<modern:SimpleStackPanel
x:Name="RectangleTabButtonIndicator"
Visibility="Visible"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom">
<Border Width="32" Height="4"
Background="#2563eb" CornerRadius="2" />
</modern:SimpleStackPanel>
<modern:SimpleStackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,2">
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="20" Width="20">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="RectangleTabButtonIcon" Brush="#2563eb" Geometry="F0 M24,24z M0,0z M2.87868,2.87868C3.44129,2.31607 4.20435,2 5,2 5.55228,2 6,2.44772 6,3 6,3.55228 5.55228,4 5,4 4.73478,4 4.48043,4.10536 4.29289,4.29289 4.10536,4.48043 4,4.73478 4,5 4,5.55228 3.55228,6 3,6 2.44772,6 2,5.55228 2,5 2,4.20435 2.31607,3.44129 2.87868,2.87868z M18,3C18,2.44772 18.4477,2 19,2 19.7957,2 20.5587,2.31607 21.1213,2.87868 21.6839,3.44129 22,4.20435 22,5 22,5.55228 21.5523,6 21,6 20.4477,6 20,5.55228 20,5 20,4.73478 19.8946,4.48043 19.7071,4.29289 19.5196,4.10536 19.2652,4 19,4 18.4477,4 18,3.55228 18,3z M11.2929,11.2929C11.5758,11.0101,12,10.923,12.3714,11.0716L22.3714,15.0716C22.7518,15.2237 23.0009,15.5924 23,16.002 22.9992,16.4117 22.7486,16.7794 22.3677,16.93L18.4707,18.4707 16.93,22.3677C16.7794,22.7486 16.4117,22.9992 16.002,23 15.5924,23.0009 15.2237,22.7518 15.0716,22.3714L11.0716,12.3714C10.923,12,11.0101,11.5758,11.2929,11.2929z M4,19C4,18.4477 3.55228,18 3,18 2.44772,18 2,18.4477 2,19 2,19.7957 2.31607,20.5587 2.87868,21.1213 3.44129,21.6839 4.20435,22 5,22 5.55228,22 6,21.5523 6,21 6,20.4477 5.55228,20 5,20 4.73478,20 4.48043,19.8946 4.29289,19.7071 4.10536,19.5196 4,19.2652 4,19z M8,3C8,2.44772,8.44772,2,9,2L10,2C10.5523,2 11,2.44772 11,3 11,3.55228 10.5523,4 10,4L9,4C8.44772,4,8,3.55228,8,3z M9,20C8.44772,20 8,20.4477 8,21 8,21.5523 8.44772,22 9,22L11,22C11.5523,22 12,21.5523 12,21 12,20.4477 11.5523,20 11,20L9,20z M13,3C13,2.44772,13.4477,2,14,2L15,2C15.5523,2 16,2.44772 16,3 16,3.55228 15.5523,4 15,4L14,4C13.4477,4,13,3.55228,13,3z M4,9C4,8.44772 3.55228,8 3,8 2.44772,8 2,8.44772 2,9L2,10C2,10.5523 2.44772,11 3,11 3.55228,11 4,10.5523 4,10L4,9z M21,8C21.5523,8,22,8.44772,22,9L22,11C22,11.5523 21.5523,12 21,12 20.4477,12 20,11.5523 20,11L20,9C20,8.44772,20.4477,8,21,8z M4,14C4,13.4477 3.55228,13 3,13 2.44772,13 2,13.4477 2,14L2,15C2,15.5523 2.44772,16 3,16 3.55228,16 4,15.5523 4,15L4,14z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
x:Name="RectangleTabButtonText"
Foreground="#2563eb"
FontWeight="Medium"
FontSize="14" TextAlignment="Center"
VerticalAlignment="Center"
Text="矩形框选" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
</modern:SimpleStackPanel>
<Border Name="CloseButtonBorder" MouseDown="CloseButtonBorder_MouseDown" MouseUp="CloseButtonBorder_MouseUp" MouseLeave="CloseButtonBorder_MouseLeave"
Height="34" Width="34" CornerRadius="6" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,6,8,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#dc2626" Geometry="F0 M24,24z M0,0z M18.7071,6.70711C19.0976,6.31658 19.0976,5.68342 18.7071,5.29289 18.3166,4.90237 17.6834,4.90237 17.2929,5.29289L12,10.5858 6.70711,5.29289C6.31658,4.90237 5.68342,4.90237 5.29289,5.29289 4.90237,5.68342 4.90237,6.31658 5.29289,6.70711L10.5858,12 5.29289,17.2929C4.90237,17.6834 4.90237,18.3166 5.29289,18.7071 5.68342,19.0976 6.31658,19.0976 6.70711,18.7071L12,13.4142 17.2929,18.7071C17.6834,19.0976 18.3166,19.0976 18.7071,18.7071 19.0976,18.3166 19.0976,17.6834 18.7071,17.2929L13.4142,12 18.7071,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
<Grid Margin="0,40,0,0" modern:ThemeManager.RequestedTheme="Light">
<!--main menu-->
<Border Margin="6" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<modern:SimpleStackPanel Orientation="Vertical">
<Grid Margin="8,9,8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Click="SelectAllButtonClicked" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M5,4C5,3.44772 4.55228,3 4,3 3.44772,3 3,3.44772 3,4L3,4.01C3,4.56228 3.44772,5.01 4,5.01 4.55228,5.01 5,4.56228 5,4.01L5,4z M7.58579,7.58579C7.96086,7.21071,8.46957,7,9,7L15,7C15.5304,7 16.0391,7.21071 16.4142,7.58579 16.7893,7.96086 17,8.46957 17,9L17,15C17,15.5304 16.7893,16.0391 16.4142,16.4142 16.0391,16.7893 15.5304,17 15,17L9,17C8.46957,17 7.96086,16.7893 7.58579,16.4142 7.21071,16.0391 7,15.5304 7,15L7,9C7,8.46957,7.21071,7.96086,7.58579,7.58579z M12,19C12.5523,19,13,19.4477,13,20L13,20.01C13,20.5623 12.5523,21.01 12,21.01 11.4477,21.01 11,20.5623 11,20.01L11,20C11,19.4477,11.4477,19,12,19z M17,20C17,19.4477 16.5523,19 16,19 15.4477,19 15,19.4477 15,20L15,20.01C15,20.5623 15.4477,21.01 16,21.01 16.5523,21.01 17,20.5623 17,20.01L17,20z M8,19C8.55228,19,9,19.4477,9,20L9,20.01C9,20.5623 8.55228,21.01 8,21.01 7.44772,21.01 7,20.5623 7,20.01L7,20C7,19.4477,7.44772,19,8,19z M5,20C5,19.4477 4.55228,19 4,19 3.44772,19 3,19.4477 3,20L3,20.01C3,20.5623 3.44772,21.01 4,21.01 4.55228,21.01 5,20.5623 5,20.01L5,20z M4,15C4.55228,15,5,15.4477,5,16L5,16.01C5,16.5623 4.55228,17.01 4,17.01 3.44772,17.01 3,16.5623 3,16.01L3,16C3,15.4477,3.44772,15,4,15z M5,12C5,11.4477 4.55228,11 4,11 3.44772,11 3,11.4477 3,12L3,12.01C3,12.5623 3.44772,13.01 4,13.01 4.55228,13.01 5,12.5623 5,12.01L5,12z M4,7C4.55228,7,5,7.44772,5,8L5,8.01C5,8.56228 4.55228,9.01 4,9.01 3.44772,9.01 3,8.56228 3,8.01L3,8C3,7.44772,3.44772,7,4,7z M8,3C8.55228,3,9,3.44772,9,4L9,4.01C9,4.56228 8.55228,5.01 8,5.01 7.44772,5.01 7,4.56228 7,4.01L7,4C7,3.44772,7.44772,3,8,3z M13,4C13,3.44772 12.5523,3 12,3 11.4477,3 11,3.44772 11,4L11,4.01C11,4.56228 11.4477,5.01 12,5.01 12.5523,5.01 13,4.56228 13,4.01L13,4z M16,3C16.5523,3,17,3.44772,17,4L17,4.01C17,4.56228 16.5523,5.01 16,5.01 15.4477,5.01 15,4.56228 15,4.01L15,4C15,3.44772,15.4477,3,16,3z M21,4C21,3.44772 20.5523,3 20,3 19.4477,3 19,3.44772 19,4L19,4.01C19,4.56228 19.4477,5.01 20,5.01 20.5523,5.01 21,4.56228 21,4.01L21,4z M20,7C20.5523,7,21,7.44772,21,8L21,8.01C21,8.56228 20.5523,9.01 20,9.01 19.4477,9.01 19,8.56228 19,8.01L19,8C19,7.44772,19.4477,7,20,7z M21,12C21,11.4477 20.5523,11 20,11 19.4477,11 19,11.4477 19,12L19,12.01C19,12.5623 19.4477,13.01 20,13.01 20.5523,13.01 21,12.5623 21,12.01L21,12z M20,15C20.5523,15,21,15.4477,21,16L21,16.01C21,16.5623 20.5523,17.01 20,17.01 19.4477,17.01 19,16.5623 19,16.01L19,16C19,15.4477,19.4477,15,20,15z M15,9L9,9 9,15 15,15 15,9z M21,20C21,19.4477 20.5523,19 20,19 19.4477,19 19,19.4477 19,20L19,20.01C19,20.5623 19.4477,21.01 20,21.01 20.5523,21.01 21,20.5623 21,20.01L21,20z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="全选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Click="UnSelectButtonClicked" ClipToBounds="False" Grid.Column="1" HorizontalAlignment="Stretch" Margin="3,0,3,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M3.70711,2.29289C3.31658,1.90237 2.68342,1.90237 2.29289,2.29289 1.90237,2.68342 1.90237,3.31658 2.29289,3.70711L7,8.41421 7,15C7,15.5304 7.21071,16.0391 7.58579,16.4142 7.96086,16.7893 8.46957,17 9,17L15.5858,17 20.2929,21.7071C20.6834,22.0976 21.3166,22.0976 21.7071,21.7071 22.0976,21.3166 22.0976,20.6834 21.7071,20.2929L3.70711,2.29289z M13.5858,15L9,10.4142 9,15 13.5858,15z M8,3C8.55228,3,9,3.44772,9,4L9,4.01C9,4.56228 8.55228,5.01 8,5.01 7.44772,5.01 7,4.56228 7,4.01L7,4C7,3.44772,7.44772,3,8,3z M12,9C11.4477,9 11,8.55228 11,8 11,7.44772 11.4477,7 12,7L15,7C15.5304,7 16.0391,7.21071 16.4142,7.58579 16.7893,7.96086 17,8.46957 17,9L17,12C17,12.5523 16.5523,13 16,13 15.4477,13 15,12.5523 15,12L15,9 12,9z M13,20C13,19.4477 12.5523,19 12,19 11.4477,19 11,19.4477 11,20L11,20.01C11,20.5623 11.4477,21.01 12,21.01 12.5523,21.01 13,20.5623 13,20.01L13,20z M16,19C16.5523,19,17,19.4477,17,20L17,20.01C17,20.5623 16.5523,21.01 16,21.01 15.4477,21.01 15,20.5623 15,20.01L15,20C15,19.4477,15.4477,19,16,19z M9,20C9,19.4477 8.55228,19 8,19 7.44772,19 7,19.4477 7,20L7,20.01C7,20.5623 7.44772,21.01 8,21.01 8.55228,21.01 9,20.5623 9,20.01L9,20z M4,19C4.55228,19,5,19.4477,5,20L5,20.01C5,20.5623 4.55228,21.01 4,21.01 3.44772,21.01 3,20.5623 3,20.01L3,20C3,19.4477,3.44772,19,4,19z M5,16C5,15.4477 4.55228,15 4,15 3.44772,15 3,15.4477 3,16L3,16.01C3,16.5623 3.44772,17.01 4,17.01 4.55228,17.01 5,16.5623 5,16.01L5,16z M4,11C4.55228,11,5,11.4477,5,12L5,12.01C5,12.5623 4.55228,13.01 4,13.01 3.44772,13.01 3,12.5623 3,12.01L3,12C3,11.4477,3.44772,11,4,11z M5,8C5,7.44772 4.55228,7 4,7 3.44772,7 3,7.44772 3,8L3,8.01C3,8.56228 3.44772,9.01 4,9.01 4.55228,9.01 5,8.56228 5,8.01L5,8z M13,4C13,3.44772 12.5523,3 12,3 11.4477,3 11,3.44772 11,4L11,4.01C11,4.56228 11.4477,5.01 12,5.01 12.5523,5.01 13,4.56228 13,4.01L13,4z M16,3C16.5523,3,17,3.44772,17,4L17,4.01C17,4.56228 16.5523,5.01 16,5.01 15.4477,5.01 15,4.56228 15,4.01L15,4C15,3.44772,15.4477,3,16,3z M21,4C21,3.44772 20.5523,3 20,3 19.4477,3 19,3.44772 19,4L19,4.01C19,4.56228 19.4477,5.01 20,5.01 20.5523,5.01 21,4.56228 21,4.01L21,4z M20,7C20.5523,7,21,7.44772,21,8L21,8.01C21,8.56228 20.5523,9.01 20,9.01 19.4477,9.01 19,8.56228 19,8.01L19,8C19,7.44772,19.4477,7,20,7z M21,12C21,11.4477 20.5523,11 20,11 19.4477,11 19,11.4477 19,12L19,12.01C19,12.5623 19.4477,13.01 20,13.01 20.5523,13.01 21,12.5623 21,12.01L21,12z M20,15C20.5523,15,21,15.4477,21,16L21,16.01C21,16.5623 20.5523,17.01 20,17.01 19.4477,17.01 19,16.5623 19,16.01L19,16C19,15.4477,19.4477,15,20,15z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="清选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
<Button Click="ReverseSelectButtonClicked" Grid.Column="2" HorizontalAlignment="Stretch" Margin="3,0,0,0">
<modern:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<Image Height="19" Width="19">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M10,5C9.73478,5 9.48043,5.10536 9.29289,5.29289 9.10536,5.48043 9,5.73478 9,6L9,7 10,7C10.5523,7 11,7.44772 11,8 11,8.55228 10.5523,9 10,9L9,9 9,10C9,10.5523 8.55228,11 8,11 7.44772,11 7,10.5523 7,10L7,9 6,9C5.73478,9 5.48043,9.10536 5.29289,9.29289 5.10536,9.48043 5,9.73478 5,10L5,18C5,18.2652 5.10536,18.5196 5.29289,18.7071 5.48043,18.8946 5.73478,19 6,19L14,19C14.2652,19 14.5196,18.8946 14.7071,18.7071 14.8946,18.5196 15,18.2652 15,18L15,17 14,17C13.4477,17 13,16.5523 13,16 13,15.4477 13.4477,15 14,15L15,15 15,14C15,13.4477 15.4477,13 16,13 16.5523,13 17,13.4477 17,14L17,15 18,15C18.2652,15 18.5196,14.8946 18.7071,14.7071 18.8946,14.5196 19,14.2652 19,14L19,6C19,5.73478 18.8946,5.48043 18.7071,5.29289 18.5196,5.10536 18.2652,5 18,5L10,5z M7.87868,3.87868C8.44129,3.31607,9.20435,3,10,3L18,3C18.7956,3 19.5587,3.31607 20.1213,3.87868 20.6839,4.44129 21,5.20435 21,6L21,14C21,14.7957 20.6839,15.5587 20.1213,16.1213 19.5587,16.6839 18.7957,17 18,17L17,17 17,18C17,18.7957 16.6839,19.5587 16.1213,20.1213 15.5587,20.6839 14.7957,21 14,21L6,21C5.20435,21 4.44129,20.6839 3.87868,20.1213 3.31607,19.5587 3,18.7956 3,18L3,10C3,9.20435 3.31607,8.44129 3.87868,7.87868 4.44129,7.31607 5.20435,7 6,7L7,7 7,6C7,5.20435,7.31607,4.44129,7.87868,3.87868z M9,14C9,13.4477 8.55228,13 8,13 7.44772,13 7,13.4477 7,14L7,16C7,16.5523,7.44772,17,8,17L10,17C10.5523,17 11,16.5523 11,16 11,15.4477 10.5523,15 10,15L9,15 9,14z M13,8C13,7.44772,13.4477,7,14,7L16,7C16.5523,7,17,7.44772,17,8L17,10C17,10.5523 16.5523,11 16,11 15.4477,11 15,10.5523 15,10L15,9 14,9C13.4477,9,13,8.55228,13,8z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Text="反选" VerticalAlignment="Center"></TextBlock>
</modern:SimpleStackPanel>
</Button>
</Grid>
<modern:SimpleStackPanel Spacing="-4" Orientation="Vertical" Margin="11,4,0,0">
<CheckBox Name="cb1" Checked="cb1cked" Unchecked="cb1cked" Content="将墨迹缩放应用于触笔笔尖" IsChecked="True"></CheckBox>
<CheckBox Name="cb2" Checked="cb2cked" Unchecked="cb2cked" Content="仅命中全部包含的墨迹" IsChecked="True"></CheckBox>
<CheckBox Name="cb3" Checked="cb3cked" Unchecked="cb3cked" Content="允许点选命中被锁定的墨迹" IsChecked="True"></CheckBox>
</modern:SimpleStackPanel>
</modern:SimpleStackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
</UserControl>
@@ -0,0 +1,179 @@
using iNKORE.UI.WPF.Modern.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static Ink_Canvas.Popups.ColorPalette;
namespace Ink_Canvas.Popups {
public partial class SelectionPopup : UserControl {
public SelectionPopup() {
InitializeComponent();
SelectionModeTabButtonBorders = new Border[] {
LassoTabButton, RectangleTabButton
};
SelectionModeTabButtonIndicators = new SimpleStackPanel[] {
LassoTabButtonIndicator, RectangleTabButtonIndicator
};
SelectionModeTabButtonIcons = new GeometryDrawing[] {
LassoTabButtonIcon, RectangleTabButtonIcon
};
SelectionModeTabButtonTexts = new TextBlock[] {
LassoTabButtonText, RectangleTabButtonText
};
UpdateSelectionModeButtonsCheckedDisplayStatus();
}
private bool isCloseButtonDown = false;
public event EventHandler<RoutedEventArgs> SelectionPopupShouldCloseEvent;
public event EventHandler<RoutedEventArgs> SelectAllEvent;
public event EventHandler<RoutedEventArgs> UnSelectEvent;
public event EventHandler<RoutedEventArgs> ReverseSelectEvent;
public event EventHandler<RoutedEventArgs> ApplyScaleToStylusTipChanged;
public event EventHandler<RoutedEventArgs> OnlyHitTestFullyContainedStrokesChanged;
public event EventHandler<RoutedEventArgs> AllowClickToSelectLockedStrokeChanged;
public bool ApplyScaleToStylusTip {
get => cb1.IsChecked??false;
set {
isProgramicallyChangeCheckBox = true;
cb1.IsChecked = value;
isProgramicallyChangeCheckBox = false;
}
}
public bool OnlyHitTestFullyContainedStrokes {
get => cb2.IsChecked ?? false;
set {
isProgramicallyChangeCheckBox = true;
cb2.IsChecked = value;
isProgramicallyChangeCheckBox = false;
}
}
public bool AllowClickToSelectLockedStroke {
get => cb3.IsChecked ?? false;
set {
isProgramicallyChangeCheckBox = true;
cb3.IsChecked = value;
isProgramicallyChangeCheckBox = false;
}
}
public Border[] SelectionModeTabButtonBorders;
public SimpleStackPanel[] SelectionModeTabButtonIndicators;
public GeometryDrawing[] SelectionModeTabButtonIcons;
public TextBlock[] SelectionModeTabButtonTexts;
public enum SelectionMode {
LassoMode,
RectangleMode
}
private SelectionMode _selectionModeSelected = SelectionMode.LassoMode;
public SelectionMode SelectionModeSelected {
get => _selectionModeSelected;
set {
_selectionModeSelected = value;
UpdateSelectionModeButtonsCheckedDisplayStatus();
}
}
public event EventHandler<SelectionModeChangedEventArgs> SelectionModeChanged;
public class SelectionModeChangedEventArgs : EventArgs
{
public SelectionMode PreviousMode { get; set; }
public SelectionMode NowMode { get; set; }
}
private void UpdateSelectionModeButtonsCheckedDisplayStatus() {
foreach (var bd in SelectionModeTabButtonBorders) {
bd.Background = new SolidColorBrush(Colors.Transparent);
}
foreach (var indicator in SelectionModeTabButtonIndicators) {
indicator.Visibility = Visibility.Hidden;
}
foreach (var gd in SelectionModeTabButtonIcons) {
gd.Brush = new SolidColorBrush(Color.FromRgb(63, 63, 70));
}
foreach (var text in SelectionModeTabButtonTexts) {
text.Foreground = new SolidColorBrush(Color.FromRgb(63, 63, 70));
text.FontWeight = FontWeights.Normal;
}
SelectionModeTabButtonBorders[(int)_selectionModeSelected].Background = new SolidColorBrush(Color.FromArgb(34, 59, 130, 246));
SelectionModeTabButtonIndicators[(int)_selectionModeSelected].Visibility = Visibility.Visible;
SelectionModeTabButtonIcons[(int)_selectionModeSelected].Brush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
SelectionModeTabButtonTexts[(int)_selectionModeSelected].Foreground = new SolidColorBrush(Color.FromRgb(37, 99, 235));
SelectionModeTabButtonTexts[(int)_selectionModeSelected].FontWeight = FontWeights.Bold;
}
private bool isProgramicallyChangeCheckBox = false;
private void cb1cked(object sender, RoutedEventArgs e) {
if (isProgramicallyChangeCheckBox) return;
ApplyScaleToStylusTipChanged?.Invoke(null,new RoutedEventArgs());
}
private void cb2cked(object sender, RoutedEventArgs e) {
if (isProgramicallyChangeCheckBox) return;
OnlyHitTestFullyContainedStrokesChanged?.Invoke(null,new RoutedEventArgs());
}
private void cb3cked(object sender, RoutedEventArgs e) {
if (isProgramicallyChangeCheckBox) return;
AllowClickToSelectLockedStrokeChanged?.Invoke(null,new RoutedEventArgs());
}
private void CloseButtonBorder_MouseDown(object sender, MouseButtonEventArgs e) {
isCloseButtonDown = true;
CloseButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 220, 38, 38));
}
private void CloseButtonBorder_MouseLeave(object sender, MouseEventArgs e) {
isCloseButtonDown = false;
CloseButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
}
private void SelectionModeTabButton_MouseDown(object sender, MouseButtonEventArgs e) {
var pre = _selectionModeSelected;
_selectionModeSelected = (SelectionMode)Array.IndexOf(SelectionModeTabButtonBorders, (Border)sender);
UpdateSelectionModeButtonsCheckedDisplayStatus();
SelectionModeChanged?.Invoke(this, new SelectionModeChangedEventArgs() {
PreviousMode = pre,
NowMode = _selectionModeSelected,
});
}
private void CloseButtonBorder_MouseUp(object sender, MouseButtonEventArgs e) {
if (!isCloseButtonDown) return;
CloseButtonBorder_MouseLeave(null, null);
SelectionPopupShouldCloseEvent?.Invoke(this,new RoutedEventArgs());
}
private void SelectAllButtonClicked(object sender, RoutedEventArgs e) {
SelectAllEvent?.Invoke(this,new RoutedEventArgs());
}
private void UnSelectButtonClicked(object sender, RoutedEventArgs e) {
UnSelectEvent?.Invoke(this,new RoutedEventArgs());
}
private void ReverseSelectButtonClicked(object sender, RoutedEventArgs e) {
ReverseSelectEvent?.Invoke(this,new RoutedEventArgs());
}
}
}
@@ -0,0 +1,299 @@
<UserControl x:Class="Ink_Canvas.Popups.ShapeDrawingPopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Popups"
xmlns:modern="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d" Width="570" Height="380" UseLayoutRounding="True">
<UserControl.Resources>
<DrawingImage x:Key="LineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M85.0522,17.5355L17.5355,85.0522 14,81.5167 81.5167,14 85.0522,17.5355z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="DottedLineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M84.2489,16.7322C85.2252,17.7085,85.2252,19.2915,84.2489,20.2678L84.213,20.3037C83.2367,21.28 81.6538,21.28 80.6775,20.3037 79.7012,19.3274 79.7012,17.7444 80.6775,16.7681L80.7134,16.7322C81.6897,15.7559,83.2726,15.7559,84.2489,16.7322z M78.4683,22.5128C79.4447,23.4891,79.4447,25.072,78.4683,26.0483L78.3965,26.1201C77.4202,27.0965 75.8373,27.0965 74.861,26.1201 73.8847,25.1438 73.8847,23.5609 74.861,22.5846L74.9328,22.5128C75.9091,21.5365,77.492,21.5365,78.4683,22.5128z M72.6519,28.3293C73.6282,29.3056,73.6282,30.8885,72.6519,31.8648L72.5801,31.9366C71.6037,32.9129 70.0208,32.9129 69.0445,31.9366 68.0682,30.9603 68.0682,29.3774 69.0445,28.4011L69.1163,28.3293C70.0926,27.353,71.6756,27.353,72.6519,28.3293z M66.8354,34.1457C67.8117,35.122,67.8117,36.705,66.8354,37.6813L66.7636,37.7531C65.7873,38.7294 64.2044,38.7294 63.2281,37.7531 62.2517,36.7768 62.2517,35.1939 63.2281,34.2175L63.2999,34.1457C64.2762,33.1694,65.8591,33.1694,66.8354,34.1457z M61.0189,39.9622C61.9952,40.9385,61.9952,42.5214,61.0189,43.4977L60.9471,43.5695C59.9708,44.5459 58.3879,44.5459 57.4116,43.5695 56.4353,42.5932 56.4353,41.0103 57.4116,40.034L57.4834,39.9622C58.4597,38.9859,60.0426,38.9859,61.0189,39.9622z M55.2025,45.7787C56.1788,46.755,56.1788,48.3379,55.2025,49.3142L55.1307,49.386C54.1544,50.3623 52.5714,50.3623 51.5951,49.386 50.6188,48.4097 50.6188,46.8268 51.5951,45.8505L51.6669,45.7787C52.6432,44.8024,54.2262,44.8024,55.2025,45.7787z M49.386,51.5951C50.3623,52.5714,50.3623,54.1544,49.386,55.1307L49.3142,55.2025C48.3379,56.1788 46.755,56.1788 45.7787,55.2025 44.8024,54.2262 44.8024,52.6432 45.7787,51.6669L45.8505,51.5951C46.8268,50.6188,48.4097,50.6188,49.386,51.5951z M43.5695,57.4116C44.5458,58.3879,44.5458,59.9708,43.5695,60.9471L43.4977,61.0189C42.5214,61.9953 40.9385,61.9953 39.9622,61.0189 38.9859,60.0426 38.9859,58.4597 39.9622,57.4834L40.034,57.4116C41.0103,56.4353,42.5932,56.4353,43.5695,57.4116z M37.7531,63.2281C38.7294,64.2044,38.7294,65.7873,37.7531,66.7636L37.6813,66.8354C36.705,67.8117 35.122,67.8117 34.1457,66.8354 33.1694,65.8591 33.1694,64.2762 34.1457,63.2999L34.2175,63.2281C35.1938,62.2518,36.7768,62.2518,37.7531,63.2281z M31.9366,69.0445C32.9129,70.0208,32.9129,71.6038,31.9366,72.5801L31.8648,72.6519C30.8885,73.6282 29.3056,73.6282 28.3293,72.6519 27.353,71.6756 27.353,70.0927 28.3293,69.1163L28.4011,69.0445C29.3774,68.0682,30.9603,68.0682,31.9366,69.0445z M26.1201,74.861C27.0964,75.8373,27.0964,77.4202,26.1201,78.3965L26.0483,78.4683C25.072,79.4447 23.4891,79.4447 22.5128,78.4683 21.5365,77.492 21.5365,75.9091 22.5128,74.9328L22.5846,74.861C23.5609,73.8847,25.1438,73.8847,26.1201,74.861z M20.3037,80.6775C21.28,81.6538,21.28,83.2367,20.3037,84.213L20.2678,84.2489C19.2915,85.2252 17.7085,85.2252 16.7322,84.2489 15.7559,83.2726 15.7559,81.6897 16.7322,80.7134L16.7681,80.6775C17.7444,79.7011,19.3274,79.7011,20.3037,80.6775z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="DashedLineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M18.0094,85.5261L14.4739,81.9906 19.6175,76.847 23.153,80.3825 18.0094,85.5261z M22.8336,73.6309L33.1208,63.3437 36.6563,66.8792 26.3691,77.1664 22.8336,73.6309z M36.3369,60.1275L46.6241,49.8403 50.1597,53.3759 39.8725,63.6631 36.3369,60.1275z M49.8403,46.6242L60.1275,36.337 63.663,39.8725 53.3758,50.1597 49.8403,46.6242z M63.3436,33.1209L73.6308,22.8337 77.1663,26.3692 66.8791,36.6564 63.3436,33.1209z M76.8469,19.6175L81.9905,14.4739 85.5261,18.0095 80.3825,23.1531 76.8469,19.6175z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ArrowLineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M44.0901,76.2514L16.2062,83.7229 23.6777,55.839 32.1161,64.2774 81.9551,14.4384 85.4906,17.974 35.6516,67.813 44.0901,76.2514z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ArrowLineTwoSideIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M44.0901,76.2514L16.2062,83.7229 23.6777,55.839 32.1161,64.2774 64.2774,32.1161 55.839,23.6777 83.7229,16.2062 76.2514,44.0901 67.813,35.6516 35.6516,67.813 44.0901,76.2514z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="RectIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M14,14L86,14 86,86 14,86 14,14z M19,19L19,81 81,81 81,19 19,19z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="CircleIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M50,81C67.1208,81 81,67.1208 81,50 81,32.8792 67.1208,19 50,19 32.8792,19 19,32.8792 19,50 19,67.1208 32.8792,81 50,81z M50,86C69.8823,86 86,69.8823 86,50 86,30.1177 69.8823,14 50,14 30.1177,14 14,30.1177 14,50 14,69.8823 30.1177,86 50,86z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="PieIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M50,50L50,14C48.3206,14 46.6501,14.1175 45,14.3489 39.6543,15.0986 34.5233,17.0444 29.9995,20.0671 24.0793,24.0228 19.4651,29.6453 16.7404,36.2234 14.0156,42.8015 13.3027,50.0399 14.6917,57.0232 16.0808,64.0066 19.5095,70.4211 24.5442,75.4558 29.5789,80.4905 35.9934,83.9192 42.9768,85.3083 49.9601,86.6973 57.1985,85.9844 63.7766,83.2596 70.3547,80.5349 75.9772,75.9207 79.9329,70.0005 82.9556,65.4767 84.9014,60.3457 85.6511,55 85.8825,53.3499 86,51.6794 86,50L50,50z M80.5941,55L45,55 45,19.4059C40.6473,20.1173 36.4765,21.7527 32.7773,24.2244 27.6794,27.6308 23.7061,32.4723 21.3597,38.1368 19.0134,43.8013 18.3995,50.0344 19.5957,56.0478 20.7918,62.0612 23.7443,67.5849 28.0797,71.9203 32.4151,76.2557 37.9388,79.2082 43.9522,80.4043 49.9656,81.6005 56.1987,80.9866 61.8632,78.6403 67.5277,76.2939 72.3692,72.3206 75.7756,67.2227 78.2473,63.5235 79.8828,59.3527 80.5941,55z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="TriangleIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M49.9999,14L91.5691,86 8.43066,86 49.9999,14z M49.9999,24L17.0909,81 82.9089,81 49.9999,24z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="RightTriangleIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M14,14L87,87 14,87 14,14z M19.0644,81.9356L19.0644,26.2267 74.7733,81.9356 19.0644,81.9356z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="DiamondIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M50.0711,14L86.1421,50.0711 50.0711,86.1421 14,50.0711 50.0711,14z M50.0711,21.0711L79.0711,50.0711 50.0711,79.0711 21.0711,50.0711 50.0711,21.0711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ParallelogramIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M25.9355,14L88.1211,14 74.1856,86 12,86 25.9355,14z M30.0605,19L82.0605,19 70.0605,81 18.0605,81 30.0605,19z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="FourLineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M15,19L85,19 85,14 15,14 15,19z M15,41.3922L85,41.3922 85,36.3922 15,36.3922 15,41.3922z M85,63.7844L15,63.7844 15,58.7844 85,58.7844 85,63.7844z M15,86.1766L85,86.1766 85,81.1766 15,81.1766 15,86.1766z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="FiveLineIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M85,19.0398L15,19.0398 15,14.0398 85,14.0398 85,19.0398z M85,35.7699L15,35.7699 15,30.7699 85,30.7699 85,35.7699z M15,52.5L85,52.5 85,47.5 15,47.5 15,52.5z M85,69.2301L15,69.2301 15,64.2301 85,64.2301 85,69.2301z M15,85.9602L85,85.9602 85,80.9602 15,80.9602 15,85.9602z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="DefaultAxisIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M47.1749,12L55.8352,30 49.6748,30 49.6748,48.6945 72.1748,48.6945 72.1748,42.3397 90.1748,51 72.1748,59.6602 72.1748,53.6945 49.6748,53.6945 49.6748,88 44.6748,88 44.6748,53.6945 9.8252,53.6945 9.8252,48.6945 44.6748,48.6945 44.6748,30 38.5146,30 47.1749,12z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Axis2Icon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M21.0001,14L29.6604,32 23.5,32 23.5,73.5 72,73.5 72,67.3397 90,76 72,84.6602 72,78.5 23.5,78.5 23.5,86 18.5,86 18.5,78.5 10,78.5 10,73.5 18.5,73.5 18.5,32 12.3398,32 21.0001,14z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Axis3Icon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M28.4904,30.6699L19.8302,12.6699 11.1699,30.6699 16.8379,30.6699 16.8379,76.8167 16.8198,81.1698 70.8301,81.3941 70.8301,87.3301 88.8301,78.6698 70.8301,70.0096 70.8301,76.394 21.8379,76.1906 21.8379,30.6699 28.4904,30.6699z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Axis4Icon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M58.3352,29.5L49.6749,11.5 41.0146,29.5 47.1748,29.5 47.1748,75.1945 10.3252,75.1945 10.3252,80.1945 47.1748,80.1945 47.1748,88.5 52.1748,88.5 52.1748,80.1945 71.6748,80.1945 71.6748,86.1602 89.6748,77.5 71.6748,68.8397 71.6748,75.1945 52.1748,75.1945 52.1748,29.5 58.3352,29.5z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ThreeDimensionAxisIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M47.6249,26.9792L38.9646,8.97919 30.3044,26.9792 36.3913,26.9792 36.3913,59.1528 19.5074,76.0367 15.6398,72.1692 9.03564,91.0208 27.8873,84.4166 23.0429,79.5723 39.9269,62.6883 72.9645,62.6883 72.9645,68.6394 90.9645,59.9792 72.9645,51.3189 72.9645,57.6883 41.3913,57.6883 41.3913,26.9792 47.6249,26.9792z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="HyperbolaIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M34.0563,69.4454C28.899,74.6027,21.9043,77.5,14.6109,77.5L14.6109,82.5C23.2304,82.5 31.4969,79.0759 37.5918,72.981 43.6868,66.886 47.1108,58.6195 47.1108,50 47.1108,41.3805 43.6867,33.114 37.5918,27.019 31.4969,20.9241 23.2304,17.5 14.6108,17.5L14.6108,22.5C21.9043,22.5 28.899,25.3973 34.0563,30.5546 39.2135,35.7118 42.1108,42.7065 42.1108,50 42.1108,57.2934 39.2135,64.2882 34.0563,69.4454z M65.9437,69.4454C71.101,74.6027,78.0957,77.5,85.3891,77.5L85.3891,82.5C76.7696,82.5 68.5031,79.0759 62.4082,72.981 56.3132,66.886 52.8892,58.6195 52.8892,50 52.8892,41.3805 56.3133,33.114 62.4082,27.019 68.5031,20.9241 76.7696,17.5 85.3892,17.5L85.3892,22.5C78.0957,22.5 71.101,25.3973 65.9437,30.5546 60.7865,35.7118 57.8892,42.7065 57.8892,50 57.8892,57.2934 60.7865,64.2882 65.9437,69.4454z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="HyperbolaWithFocalPointIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M34.0563,69.4454C28.899,74.6027,21.9043,77.5,14.6109,77.5L14.6109,82.5C23.2304,82.5 31.4969,79.0759 37.5918,72.981 43.6868,66.886 47.1108,58.6195 47.1108,50 47.1108,41.3805 43.6867,33.114 37.5918,27.019 31.4969,20.9241 23.2304,17.5 14.6108,17.5L14.6108,22.5C21.9043,22.5 28.899,25.3973 34.0563,30.5546 39.2135,35.7118 42.1108,42.7065 42.1108,50 42.1108,57.2934 39.2135,64.2882 34.0563,69.4454z M65.9437,69.4454C71.101,74.6027,78.0957,77.5,85.3891,77.5L85.3891,82.5C76.7696,82.5 68.5031,79.0759 62.4082,72.981 56.3132,66.886 52.8892,58.6195 52.8892,50 52.8892,41.3805 56.3133,33.114 62.4082,27.019 68.5031,20.9241 76.7696,17.5 85.3892,17.5L85.3892,22.5C78.0957,22.5 71.101,25.3973 65.9437,30.5546 60.7865,35.7118 57.8892,42.7065 57.8892,50 57.8892,57.2934 60.7865,64.2882 65.9437,69.4454z M34,50C34,52.2091 32.2091,54 30,54 27.7909,54 26,52.2091 26,50 26,47.7909 27.7909,46 30,46 32.2091,46 34,47.7909 34,50z M70,54C72.2091,54 74,52.2091 74,50 74,47.7909 72.2091,46 70,46 67.7909,46 66,47.7909 66,50 66,52.2091 67.7909,54 70,54z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ParabolaIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M20,16.2501C20,33.2011 23.3736,49.3308 29.2551,61.0939 35.1952,72.974 42.807,78.75 50,78.75 57.1931,78.75 64.8049,72.974 70.7449,61.0939 76.6265,49.3308 80,33.201 80,16.25L85,16.25C85,33.7771 81.5253,50.7134 75.217,63.33 68.9672,75.8296 60.046,83.75 50,83.75 39.954,83.75 31.0328,75.8297 24.783,63.33 18.4747,50.7134 15,33.7772 15,16.2501L20,16.2501z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Parabola2Icon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M83.7499,20C66.7989,20 50.6692,23.3736 38.9061,29.2551 27.026,35.1952 21.25,42.807 21.25,50 21.25,57.1931 27.026,64.8049 38.9061,70.7449 50.6692,76.6265 66.799,80 83.75,80L83.75,85C66.2229,85 49.2866,81.5253 36.67,75.217 24.1704,68.9672 16.25,60.046 16.25,50 16.25,39.954 24.1703,31.0328 36.67,24.783 49.2866,18.4747 66.2228,15 83.7499,15L83.7499,20z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="Parabola2WithFocalPointIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M38.9061,29.2551C50.6692,23.3736,66.7989,20,83.7499,20L83.7499,15C66.2228,15 49.2866,18.4747 36.67,24.783 24.1703,31.0328 16.25,39.954 16.25,50 16.25,60.046 24.1704,68.9672 36.67,75.217 49.2866,81.5253 66.2229,85 83.75,85L83.75,80C66.799,80 50.6692,76.6265 38.9061,70.7449 27.026,64.8049 21.25,57.1931 21.25,50 21.25,42.807 27.026,35.1952 38.9061,29.2551z M36.25,54C38.4591,54 40.25,52.2091 40.25,50 40.25,47.7909 38.4591,46 36.25,46 34.0409,46 32.25,47.7909 32.25,50 32.25,52.2091 34.0409,54 36.25,54z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="CylinderIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M50,13.1923C42.4374,13.1923 35.5317,14.1336 30.467,15.692 27.9438,16.4683 25.7926,17.4234 24.2394,18.5533 22.719,19.6594 21.5,21.1431 21.5,23L21.5,74.9231C21.5,76.9249 22.5606,78.6637 24.1126,80.075 25.6643,81.4859 27.8258,82.6877 30.3696,83.6661 35.4673,85.6268 42.4082,86.8077 50,86.8077 57.5918,86.8077 64.5327,85.6268 69.6304,83.6661 72.1742,82.6877 74.3358,81.4859 75.8874,80.075 77.4394,78.6637 78.5,76.9249 78.5,74.9231L78.5,23C78.5,21.1431 77.281,19.6594 75.7606,18.5533 74.2074,17.4234 72.0562,16.4683 69.533,15.692 64.4683,14.1336 57.5626,13.1923 50,13.1923z M65.45,31.3473C68.5378,30.7025,71.273,29.8527,73.4231,28.8166L73.4231,74.9231C73.4231,75.4135 73.1263,76.1195 72.036,76.9787 70.9627,77.8245 69.3167,78.6519 67.1489,79.3745 62.8291,80.8144 56.7659,81.7308 50,81.7308 43.2341,81.7308 37.1709,80.8144 32.8511,79.3745 30.6833,78.6519 29.0373,77.8245 27.964,76.9787 26.8737,76.1195 26.5769,75.4135 26.5769,74.9231L26.5769,28.8167C28.7271,29.8528 31.4622,30.7026 34.5501,31.3474 38.983,32.2731 44.2995,32.8077 50,32.8077 55.7005,32.8077 61.017,32.273 65.45,31.3473z M26.5769,23C26.5769,22.9974 26.6152,22.5655 27.7988,21.866 28.8819,21.2258 30.549,20.5973 32.7405,20.0494 37.1006,18.9594 43.2034,18.2692 50,18.2692 56.7966,18.2692 62.8994,18.9594 67.2595,20.0494 69.451,20.5973 71.1181,21.2258 72.2012,21.866 73.3848,22.5655 73.4231,22.9974 73.4231,23 73.4231,23.0026 73.3848,23.4345 72.2012,24.1341 71.1181,24.7742 69.451,25.4028 67.2595,25.9507 62.8994,27.0407 56.7966,27.7308 50,27.7308 43.2034,27.7308 37.1006,27.0407 32.7405,25.9507 30.549,25.4028 28.8819,24.7742 27.7988,24.1341 26.6152,23.4345 26.5769,23.0026 26.5769,23z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="CubeIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M86.3113,18.0801L44.9459,13.5372 13.689,20.4027 13.689,77.4306 54.8103,86.4628 57.2977,86.4628 86.3113,72.807 86.3113,18.0801z M31.3145,21.7874L45.1083,18.7576 69.6455,21.4524 56.8659,24.4599 31.3145,21.7874z M81.3221,69.6549L58.4624,80.4143 58.4624,29.3508 81.3221,23.9711 81.3221,69.6549z M18.6782,73.2372L18.6782,25.6667 53.4731,29.306 53.4731,80.5158 18.6782,73.2372z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="ConeIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M51.3661,14.1383C51.1808,13.7301 50.8167,13.4146 50.3598,13.3017 49.6901,13.1362 48.9939,13.4488 48.6726,14.0593L19.0272,70.3833 19.0196,70.3979 18.8911,70.6487C18.8747,70.6807 18.8594,70.7133 18.8454,70.7465 18.4691,71.6328 18.3608,72.526 18.3608,73.3332 18.3608,75.5298 19.4936,77.4657 21.2053,79.0648 22.9147,80.6617 25.3067,82.0308 28.1372,83.1492 33.8069,85.3895 41.5372,86.7422 50,86.7422 58.4627,86.7422 66.193,85.3895 71.8628,83.1492 74.6933,82.0308 77.0852,80.6617 78.7946,79.0648 80.5064,77.4657 81.6391,75.5298 81.6391,73.3332 81.6391,72.6065 81.5963,71.6942 81.2005,70.7621 81.191,70.7398 81.181,70.7176 81.1704,70.6958L81.0417,70.4294C81.0341,70.4136,81.0262,70.3979,81.018,70.3824L51.3661,14.1383z M50.0024,22.9267L23.4628,72.713C23.3998,72.9248 23.3701,73.1305 23.3701,73.3332 23.3701,74.083 23.7971,75.0062 25.0415,76.0442 26.2774,77.0751 28.1556,78.0708 30.6082,78.9361 35.4999,80.6619 42.3559,81.7574 50,81.7574 57.6441,81.7574 64.5,80.6619 69.3917,78.9361 71.8444,78.0708 73.7225,77.0751 74.9584,76.0442 76.2029,75.0062 76.6298,74.083 76.6298,73.3332 76.6298,72.7912 76.5554,72.4221 76.368,72.0964 76.3623,72.0866 76.3568,72.0768 76.3514,72.0669 76.3497,72.0636 76.3479,72.0604 76.3462,72.0572L50.0024,22.9267z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="CircleWithCenterPointIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M81,50C81,67.1208 67.1208,81 50,81 32.8792,81 19,67.1208 19,50 19,32.8792 32.8792,19 50,19 67.1208,19 81,32.8792 81,50z M86,50C86,69.8822 69.8822,86 50,86 30.1177,86 14,69.8822 14,50 14,30.1177 30.1177,14 50,14 69.8822,14 86,30.1177 86,50z M50,54C52.2091,54 54,52.2091 54,50 54,47.7909 52.2091,46 50,46 47.7909,46 46,47.7909 46,50 46,52.2091 47.7909,54 50,54z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="RectWithCenterPointIcon">
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
<GeometryDrawing Brush="#FF2B2B2F" Geometry="F0 M100,100z M0,0z M86,14L14,14 14,86 86,86 86,14z M19,81L19,19 81,19 81,81 19,81z M50,54C52.2091,54 54,52.2091 54,50 54,47.7909 52.2091,46 50,46 47.7909,46 46,47.7909 46,50 46,52.2091 47.7909,54 50,54z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</UserControl.Resources>
<Grid>
<Border Margin="8" Background="#f4f4f5" BorderBrush="#3b82f6" BorderThickness="2" CornerRadius="6">
<Border.Effect>
<DropShadowEffect BlurRadius="5" Opacity="0.2" />
</Border.Effect>
<Grid>
<modern:SimpleStackPanel Spacing="4" Margin="8,0" Height="40" VerticalAlignment="Top" Orientation="Horizontal">
<Border VerticalAlignment="Bottom" Height="34" Padding="6,0">
<Grid>
<modern:SimpleStackPanel
VerticalAlignment="Center"
Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#2563eb" Geometry="F0 M24,24z M0,0z M13.0573,17.3383C13.0573,15.0674 14.8982,13.2265 17.169,13.2265 19.4399,13.2265 21.2808,15.0674 21.2808,17.3383 21.2808,19.6091 19.4399,21.45 17.169,21.45 14.8982,21.45 13.0573,19.6091 13.0573,17.3383z M4.48141,13.2265C3.50819,13.2265,2.71924,14.0155,2.71924,14.9887L2.71924,19.6878C2.71924,20.6611,3.50819,21.45,4.48141,21.45L9.18053,21.45C10.1537,21.45,10.9427,20.6611,10.9427,19.6878L10.9427,14.9887C10.9427,14.0155,10.1537,13.2265,9.18053,13.2265L4.48141,13.2265z M12.6923,2.71599C12.4659,2.59866 12.213,2.54181 11.9581,2.55096 11.7033,2.5601 11.4551,2.63494 11.2377,2.7682 11.028,2.89676 10.8537,3.07549 10.7305,3.28809L7.24046,8.83413C7.09431,9.06224 7.01353,9.32612 7.007,9.59703 7.00043,9.86995 7.06945,10.1394 7.20645,10.3755 7.34345,10.6117 7.54308,10.8053 7.78328,10.9351 8.01558,11.0605 8.27707,11.1215 8.5406,11.1119L15.5037,11.1119 15.5065,11.1119C15.7766,11.111 16.0412,11.0362 16.2717,10.8957 16.5023,10.7551 16.6901,10.5542 16.8146,10.3146 16.9392,10.0751 16.9959,9.80598 16.9785,9.53651 16.9617,9.27545 16.876,9.02367 16.7303,8.80672L13.26,3.23562 13.2505,3.22067C13.111,3.00717,12.9187,2.83333,12.6923,2.71599z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock
Foreground="#2563eb"
FontWeight="Bold"
FontSize="17" TextAlignment="Center"
VerticalAlignment="Center"
Text="形状绘制" Margin="4,0,0,0" />
</modern:SimpleStackPanel>
</Grid>
</Border>
</modern:SimpleStackPanel>
<Border Name="CloseButtonBorder" MouseDown="CloseButtonBorder_MouseDown" MouseUp="CloseButtonBorder_MouseUp" MouseLeave="CloseButtonBorder_MouseLeave"
Height="34" Width="34" CornerRadius="6" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,6,8,0">
<Image Height="24" Width="24">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#dc2626" Geometry="F0 M24,24z M0,0z M18.7071,6.70711C19.0976,6.31658 19.0976,5.68342 18.7071,5.29289 18.3166,4.90237 17.6834,4.90237 17.2929,5.29289L12,10.5858 6.70711,5.29289C6.31658,4.90237 5.68342,4.90237 5.29289,5.29289 4.90237,5.68342 4.90237,6.31658 5.29289,6.70711L10.5858,12 5.29289,17.2929C4.90237,17.6834 4.90237,18.3166 5.29289,18.7071 5.68342,19.0976 6.31658,19.0976 6.70711,18.7071L12,13.4142 17.2929,18.7071C17.6834,19.0976 18.3166,19.0976 18.7071,18.7071 19.0976,18.3166 19.0976,17.6834 18.7071,17.2929L13.4142,12 18.7071,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Border>
<Grid Margin="0,40,0,0" modern:ThemeManager.RequestedTheme="Light">
<!--main menu-->
<Border Margin="6" Height="272" VerticalAlignment="Top" CornerRadius="6" Background="#fafafa" BorderBrush="#d4d4d8" BorderThickness="1">
<Grid>
<ItemsControl Name="ShapeDrawingItemsControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="5" Orientation="Horizontal">
</WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border MouseDown="ShapeDrawingButtonBorder_MouseDown" MouseUp="ShapeDrawingButtonBorder_MouseUp" MouseLeave="ShapeDrawingButtonBorder_MouseLeave"
Margin="5" Width="56" Height="56" CornerRadius="4" Tag="{Binding}">
<Image Width="48" Height="48" Source="{Binding Image}"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
<Grid Height="40" VerticalAlignment="Bottom" Margin="12,0">
<modern:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal" Spacing="16">
<CheckBox Content="仅单次绘制" MinWidth="0"/>
</modern:SimpleStackPanel>
<StackPanel Margin="0,0,6,0" HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Foreground="#18181b" FontSize="14" Text="粗细 : " VerticalAlignment="Center"/>
<TextBlock FontWeight="Bold" Margin="0,0,24,0" Foreground="#18181b" FontSize="14" Text="4" VerticalAlignment="Center"/>
<TextBlock Foreground="#18181b" FontSize="14" Text="颜色 : " VerticalAlignment="Center"/>
<Border Height="16" Width="16" CornerRadius="8" Background="Red"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
</UserControl>
@@ -0,0 +1,218 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Ink_Canvas.Popups {
public partial class ShapeDrawingPopup : UserControl {
public ShapeDrawingPopup() {
InitializeComponent();
ShapeDrawingItemsControl.ItemsSource = _items;
_items.Add(new ShapeDrawingItem() {
Name = "直线",
Image = FindResource("LineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Line,
});
_items.Add(new ShapeDrawingItem() {
Name = "虚线",
Image = FindResource("DashedLineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.DashedLine,
});
_items.Add(new ShapeDrawingItem() {
Name = "点虚线",
Image = FindResource("DottedLineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.DottedLine,
});
_items.Add(new ShapeDrawingItem() {
Name = "箭头",
Image = FindResource("ArrowLineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.ArrowOneSide,
});
_items.Add(new ShapeDrawingItem() {
Name = "双箭头",
Image = FindResource("ArrowLineTwoSideIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.ArrowTwoSide,
});
_items.Add(new ShapeDrawingItem() {
Name = "矩形",
Image = FindResource("RectIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Rectangle,
});
_items.Add(new ShapeDrawingItem() {
Name = "椭圆",
Image = FindResource("CircleIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Ellipse,
});
_items.Add(new ShapeDrawingItem() {
Name = "饼图形",
Image = FindResource("PieIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.PieEllipse,
});
_items.Add(new ShapeDrawingItem() {
Name = "三角形",
Image = FindResource("TriangleIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Triangle,
});
_items.Add(new ShapeDrawingItem() {
Name = "直角三角",
Image = FindResource("RightTriangleIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.RightTriangle,
});
_items.Add(new ShapeDrawingItem() {
Name = "菱形",
Image = FindResource("DiamondIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Diamond,
});
_items.Add(new ShapeDrawingItem() {
Name = "平行四边形",
Image = FindResource("ParallelogramIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Parallelogram,
});
_items.Add(new ShapeDrawingItem() {
Name = "四线三格",
Image = FindResource("FourLineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.FourLine,
});
_items.Add(new ShapeDrawingItem() {
Name = "五线谱",
Image = FindResource("FiveLineIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Staff,
});
_items.Add(new ShapeDrawingItem() {
Name = "平面坐标轴",
Image = FindResource("DefaultAxisIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Axis2D,
});
_items.Add(new ShapeDrawingItem() {
Name = "平面坐标轴2",
Image = FindResource("Axis2Icon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Axis2DA,
});
_items.Add(new ShapeDrawingItem() {
Name = "平面坐标轴3",
Image = FindResource("Axis3Icon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Axis2DB,
});
_items.Add(new ShapeDrawingItem() {
Name = "平面坐标轴4",
Image = FindResource("Axis4Icon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Axis2DC,
});
_items.Add(new ShapeDrawingItem() {
Name = "三维坐标轴",
Image = FindResource("ThreeDimensionAxisIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Axis3D,
});
_items.Add(new ShapeDrawingItem() {
Name = "双曲线",
Image = FindResource("HyperbolaIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Hyperbola,
});
_items.Add(new ShapeDrawingItem() {
Name = "带焦点的双曲线",
Image = FindResource("HyperbolaWithFocalPointIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.HyperbolaF,
});
_items.Add(new ShapeDrawingItem() {
Name = "抛物线1",
Image = FindResource("ParabolaIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Parabola,
});
_items.Add(new ShapeDrawingItem() {
Name = "抛物线2",
Image = FindResource("Parabola2Icon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.ParabolaA,
});
_items.Add(new ShapeDrawingItem() {
Name = "带焦点的抛物线2",
Image = FindResource("Parabola2WithFocalPointIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.ParabolaAF,
});
_items.Add(new ShapeDrawingItem() {
Name = "圆柱体",
Image = FindResource("CylinderIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Cylinder,
});
_items.Add(new ShapeDrawingItem() {
Name = "立方体",
Image = FindResource("CubeIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Cube,
});
_items.Add(new ShapeDrawingItem() {
Name = "圆锥体",
Image = FindResource("ConeIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.Cone,
});
_items.Add(new ShapeDrawingItem() {
Name = "带圆心的圆形",
Image = FindResource("CircleWithCenterPointIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.EllipseC,
});
_items.Add(new ShapeDrawingItem() {
Name = "带中心点的矩形",
Image = FindResource("RectWithCenterPointIcon") as DrawingImage,
Type = MainWindow.ShapeDrawingType.RectangleC,
});
}
private class ShapeDrawingItem {
public string Name { get; set; }
public DrawingImage Image { get; set; }
public MainWindow.ShapeDrawingType Type { get; set; }
}
private ObservableCollection<ShapeDrawingItem> _items = new ObservableCollection<ShapeDrawingItem>();
private bool isCloseButtonDown = false;
public event EventHandler<RoutedEventArgs> ShapeDrawingPopupShouldCloseEvent;
public class ShapeSelectedEventArgs : EventArgs {
public MainWindow.ShapeDrawingType Type { get; set; }
public string Name { get; set; }
}
public event EventHandler<ShapeSelectedEventArgs> ShapeSelectedEvent;
private void CloseButtonBorder_MouseDown(object sender, MouseButtonEventArgs e) {
isCloseButtonDown = true;
CloseButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 220, 38, 38));
}
private void CloseButtonBorder_MouseLeave(object sender, MouseEventArgs e) {
isCloseButtonDown = false;
CloseButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
}
private void CloseButtonBorder_MouseUp(object sender, MouseButtonEventArgs e) {
if (!isCloseButtonDown) return;
CloseButtonBorder_MouseLeave(null, null);
ShapeDrawingPopupShouldCloseEvent?.Invoke(this,new RoutedEventArgs());
}
private Border shapeDrawingButtonDownBorder = null;
private void ShapeDrawingButtonBorder_MouseDown(object sender, MouseButtonEventArgs e) {
if (shapeDrawingButtonDownBorder != null) return;
shapeDrawingButtonDownBorder = (Border)sender;
shapeDrawingButtonDownBorder.Background = new SolidColorBrush(Color.FromRgb(228, 228, 231));
}
private void ShapeDrawingButtonBorder_MouseLeave(object sender, MouseEventArgs e) {
if (shapeDrawingButtonDownBorder == null || shapeDrawingButtonDownBorder != sender) return;
shapeDrawingButtonDownBorder.Background = new SolidColorBrush(Colors.Transparent);
shapeDrawingButtonDownBorder = null;
}
private void ShapeDrawingButtonBorder_MouseUp(object sender, MouseButtonEventArgs e) {
if (shapeDrawingButtonDownBorder == null || shapeDrawingButtonDownBorder != sender) return;
ShapeDrawingButtonBorder_MouseLeave(sender, null);
ShapeDrawingPopupShouldCloseEvent?.Invoke(this,new RoutedEventArgs());
ShapeSelectedEvent?.Invoke(this, new ShapeSelectedEventArgs() {
Type = ((ShapeDrawingItem)((Border)sender).Tag).Type,
Name = ((ShapeDrawingItem)((Border)sender).Tag).Name
});
}
}
}