[update] 浮动工具栏按钮可见性;移除了InkCanvas的默认Delete命令修复墨迹选择的Bug;画面定格功能

This commit is contained in:
Dubi906w 2024-08-08 21:57:58 +08:00
parent 066b943adb
commit f281b9eb6f
10 changed files with 632 additions and 50 deletions

View File

@ -127,6 +127,7 @@
</Popup>
<!--// 黑/白 板幕布 //-->
<Image Name="FreezeFrameBackgroundImage" Visibility="Collapsed"/>
<Grid Name="GridBackgroundCoverHolder">
<Grid Name="GridBackgroundCover" Visibility="Collapsed" Background="#1F1F1F" />
</Grid>
@ -3460,6 +3461,10 @@
<Border Name="FloatingbarSelectionBG" Visibility="Hidden" Width="{Binding ElementName=Cursor_Icon, Path=Width}" Height="34"
Canvas.Left="28" Margin="0,-2,0,-2" Background="#2563eb"/>
</Canvas>
<Canvas Name="FloatingbarFreezeBtnBGCanvas" Margin="2,0,2,0" Visibility="Collapsed">
<Border Name="FloatingbarFreezeBtnBG" Visibility="Hidden" Width="{Binding ElementName=Cursor_Icon, Path=Width}" Height="34"
Canvas.Left="196" Margin="0,-2,0,-2" Background="#2563eb"/>
</Canvas>
<ui:SimpleStackPanel Margin="2,0" Name="StackPanelFloatingBar" Orientation="Horizontal">
<!--<ui:SimpleStackPanel Name="Cursor_Icon" MouseDown="Border_MouseDown" MouseUp="CursorIcon_Click"-->
<ui:SimpleStackPanel Name="Cursor_Icon"
@ -4398,7 +4403,6 @@
<TextBlock x:Name="ShapesToolbarTextBlock" Text="几何" Foreground="Black" Visibility="{Binding ElementName=FloatingBarTextVisibilityBindingLikeAPieceOfShit, Path=Visibility}"
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<Grid Width="0">
<Border x:Name="BorderDrawShape" Background="#fafafa" Opacity="1"
Visibility="Visible" BorderBrush="#2563eb"
@ -4638,6 +4642,50 @@
</ui:SimpleStackPanel>
</Border>
</Grid>
<ui:SimpleStackPanel
Name="FreezeFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="FreezeFloatingBarBtn_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2"
Width="28">
<Image RenderOptions.BitmapScalingMode="HighQuality" Height="17"
Margin="0,3,0,0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing x:Name="FreezeIconGeometry" Brush="#1B1B1B" Geometry="F0 M24,24z M0,0z M12.875,3.42617C12.875,2.94292 12.4833,2.55117 12,2.55117 11.5168,2.55117 11.125,2.94292 11.125,3.42617L11.125,4.58253 10.6766,4.35831C10.2444,4.1422 9.71878,4.31739 9.50266,4.74962 9.28655,5.18185 9.46174,5.70744 9.89398,5.92356L11.125,6.53909 11.125,8.48547 9.39973,9.48835 7.70825,8.51174 7.79073,7.13797C7.81969,6.65559 7.45212,6.24107 6.96974,6.21211 6.48736,6.18315 6.07283,6.55072 6.04387,7.0331L6.01383,7.53344 5.01252,6.95531C4.59401,6.71368 4.05887,6.85707 3.81724,7.27557 3.57561,7.69407 3.71899,8.22922 4.1375,8.47085L5.13889,9.04902 4.72043,9.3253C4.31715,9.59156 4.20607,10.1343 4.47233,10.5376 4.73859,10.9409 5.28136,11.052 5.68464,10.7857L6.83331,10.0273 8.51897,11.0006 8.52474,12.9961 6.83321,13.9727 5.68464,13.2144C5.28136,12.9481 4.73859,13.0592 4.47233,13.4625 4.20607,13.8658 4.31715,14.4085 4.72043,14.6748L5.13879,14.951 4.1375,15.5291C3.71899,15.7708 3.57561,16.3059 3.81724,16.7244 4.05887,17.1429 4.59401,17.2863 5.01252,17.0447L6.01383,16.4665 6.04387,16.967C6.07283,17.4494 6.48736,17.8169 6.96974,17.788 7.45212,17.759 7.81969,17.3445 7.79073,16.8621L7.70825,15.4882 9.39365,14.5151 11.125,15.5078 11.125,17.4609 9.89398,18.0764C9.46174,18.2925 9.28655,18.8181 9.50266,19.2503 9.71878,19.6826 10.2444,19.8578 10.6766,19.6417L11.125,19.4174 11.125,20.5738C11.125,21.0571 11.5168,21.4488 12,21.4488 12.4833,21.4488 12.875,21.0571 12.875,20.5738L12.875,19.4174 13.3235,19.6417C13.7557,19.8578 14.2813,19.6826 14.4974,19.2503 14.7136,18.8181 14.5384,18.2925 14.1061,18.0764L12.875,17.4609 12.875,15.5145 14.6003,14.5116 16.2918,15.4883 16.2094,16.8621C16.1804,17.3445 16.548,17.759 17.0304,17.788 17.5127,17.8169 17.9273,17.4494 17.9562,16.967L17.9863,16.4666 18.9875,17.0447C19.406,17.2863 19.9411,17.1429 20.1828,16.7244 20.4244,16.3059 20.281,15.7708 19.8625,15.5291L18.8612,14.951 19.2797,14.6748C19.6829,14.4085 19.794,13.8658 19.5278,13.4625 19.2615,13.0592 18.7187,12.9481 18.3154,13.2144L17.1668,13.9727 15.4808,12.9993 15.475,11.0039 17.1666,10.0272 18.3154,10.7857C18.7187,11.052 19.2615,10.9409 19.5278,10.5376 19.794,10.1343 19.6829,9.59156 19.2797,9.3253L18.8611,9.04892 19.8623,8.47085C20.2808,8.22922 20.4242,7.69407 20.1825,7.27557 19.9409,6.85707 19.4058,6.71368 18.9873,6.95531L17.9862,7.53326 17.9562,7.0331C17.9273,6.55072 17.5127,6.18315 17.0304,6.21211 16.548,6.24107 16.1804,6.65559 16.2094,7.13797L16.2918,8.51156 14.6062,9.48476 12.875,8.49221 12.875,6.5391 14.1061,5.92356C14.5384,5.70744 14.7136,5.18185 14.4974,4.74962 14.2813,4.31739 13.7557,4.1422 13.3235,4.35831L12.875,4.58254 12.875,3.42617z M10.269,11.0072L10.2748,13.0031 12.0058,13.9955 13.7308,12.9929 13.725,10.9967 11.9942,10.0044 10.269,11.0072z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock x:Name="FreezeToolbarTextBlock" Text="冻结" Foreground="Black" Visibility="{Binding ElementName=FloatingBarTextVisibilityBindingLikeAPieceOfShit, Path=Visibility}"
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="HandFloatingBarBtn"
MouseDown="FloatingBarToolBtnMouseDownFeedback_Panel"
MouseLeave="FloatingBarToolBtnMouseLeaveFeedback_Panel"
MouseUp="ImageDrawShape_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Margin="0,-2"
Width="28">
<Image RenderOptions.BitmapScalingMode="HighQuality" Height="17"
Margin="0,3,0,0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="#1b1b1b" Geometry="F0 M24,24z M0,0z M8.26625,10.5636L8.26625,4.76409C8.26625,4.19587 8.49174,3.65469 8.89762,3.24882 9.70937,2.43706 11.1164,2.43706 11.9282,3.24882 12.3341,3.65469 12.5595,4.18685 12.5595,4.76409L12.5595,7.22542C13.2811,7.04372 14.0969,7.22143 14.634,7.75858 14.7741,7.89866 14.8927,8.05378 14.9879,8.22061 15.7667,7.91427 16.7334,8.06091 17.3399,8.66052 17.4846,8.80521 17.6063,8.96596 17.7031,9.13907 18.4771,8.84678 19.4284,8.99693 20.0277,9.58954 20.4336,9.99541 20.6591,10.5276 20.6591,11.1048L20.6591,15.1636C20.6591,16.8232 20.0097,18.3745 18.8461,19.5471 17.6736,20.7196 16.1222,21.36 14.4627,21.36L14.4717,21.342 12.6678,21.342 12.5595,21.342C11.6395,21.2969 10.7286,21.0443 9.9078,20.6114 9.00585,20.1243 8.23017,19.4208 7.67096,18.564L7.49057,18.2934C7.20195,17.8424 6.21882,16.1377 4.49609,13.0801 4.22551,12.593 4.15335,12.0248 4.28864,11.4836 4.43296,10.9425 4.7757,10.4825 5.25373,10.1938 5.72275,9.91424 6.28196,9.79698 6.82313,9.86012 7.37332,9.93228 7.87841,10.1758 8.26625,10.5636z M16.3838,11.2756L16.3838,11.5287C16.3838,11.9707 16.7446,12.3224 17.1775,12.3224 17.6195,12.3224 17.9712,11.9617 17.9712,11.5287L17.9712,10.9579C17.9953,10.8643 18.0434,10.7801 18.1156,10.708 18.323,10.5005 18.7018,10.5005 18.9093,10.708 19.0085,10.8162 19.0716,10.9515 19.0716,11.1048L19.0716,15.1636C19.0716,16.3993 18.5936,17.5538 17.7187,18.4287 16.8528,19.3036 15.6893,19.7816 14.4536,19.7816L12.8391,19.7816C12.0725,19.7816 11.3148,19.5922 10.6474,19.2314 9.97094,18.8706 9.39369,18.3385 8.97879,17.7071L8.7984,17.4365C8.52782,17.0216 7.53567,15.2989 5.85804,12.3134 5.78588,12.1781 5.76784,12.0338 5.80392,11.8895 5.84,11.7452 5.9302,11.6189 6.05647,11.5468 6.22784,11.4476 6.42627,11.4115 6.6247,11.4295 6.82313,11.4476 7.00352,11.5468 7.14783,11.6821L8.4737,13.0079C8.72783,13.2621 9.11822,13.3056 9.41903,13.1385 9.67804,13.0065 9.85369,12.7366 9.85369,12.4307L9.85369,4.76409C9.85369,4.61076 9.9078,4.47547 10.016,4.36724 10.2235,4.15077 10.5933,4.15077 10.8098,4.36724 10.918,4.47547 10.9721,4.61076 10.9721,4.76409L10.9721,9.26642 10.9721,9.27386 10.9721,11.0778 10.9721,11.0824 10.9721,11.5287C10.9721,11.9707 11.3239,12.3224 11.7658,12.3224 12.2078,12.3224 12.5595,11.9617 12.5595,11.5287L12.5595,9.26969C12.5605,9.11807 12.6146,8.98425 12.7219,8.877 12.9293,8.66955 13.3081,8.66955 13.5156,8.877 13.6148,8.98523 13.6779,9.12052 13.6779,9.27386L13.6779,11.5287C13.6779,11.9707 14.0387,12.3225 14.4717,12.3225 14.9136,12.3225 15.2654,11.9617 15.2654,11.5287L15.2654,10.1775 15.2654,10.1758C15.2654,10.0225 15.3195,9.88717 15.4277,9.77894 15.6352,9.57149 16.014,9.57149 16.2215,9.77894 16.3207,9.88717 16.3838,10.0225 16.3838,10.1758L16.3838,10.8276C16.3719,10.919 16.3658,11.0115 16.3658,11.1048 16.3658,11.1636 16.372,11.2207 16.3838,11.2756z M4.13531,6.54094C3.89178,6.54094 3.64826,6.43271 3.49493,6.21624 3.23336,5.86448 3.31454,5.36841 3.6663,5.11586 4.4059,4.57469 5.19961,4.11469 6.02941,3.74489 6.42627,3.5645 6.89528,3.74489 7.07567,4.14175 7.25606,4.53861 7.07567,5.00763 6.67881,5.18802 5.94823,5.51272 5.25373,5.9186 4.60433,6.38761 4.46001,6.48683 4.29766,6.54094 4.13531,6.54094z M17.3669,5.94565C17.5022,6.02683,17.6465,6.0629,17.7909,6.0629L17.7818,6.07192C18.0434,6.07192 18.296,5.93663 18.4493,5.70212 18.6838,5.33232 18.5756,4.84527 18.2058,4.61076 17.1144,3.91626 15.9238,3.39313 14.6701,3.05941 14.2552,2.95117 13.8133,3.1947 13.705,3.61862 13.5968,4.04253 13.8403,4.47547 14.2642,4.5837 15.3556,4.88135 16.4019,5.34134 17.3669,5.94565z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock x:Name="HandToolbarTextBlock" Text="漫游" Foreground="Black" Visibility="{Binding ElementName=FloatingBarTextVisibilityBindingLikeAPieceOfShit, Path=Visibility}"
FontSize="8" Margin="0,1,0,0" TextAlignment="Center" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel
Name="SymbolIconUndo"
MouseUp="SymbolIconUndo_MouseUp"
@ -5110,9 +5158,7 @@
<Border Margin="2,0,0,0" x:Name="EnableTwoFingerGestureBorder" Visibility="Visible" Width="36"
Height="36" CornerRadius="5" Background="#fafafa" BorderBrush="#9952525b"
BorderThickness="1">
<ui:SimpleStackPanel
MouseUp="TwoFingerGestureBorder_MouseUp" Background="Transparent"
<ui:SimpleStackPanel MouseUp="TwoFingerGestureBorder_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="36" Margin="0">
<Image x:Name="EnableTwoFingerGestureBtn" Source="/Resources/new-icons/gesture.png"
RenderOptions.BitmapScalingMode="HighQuality" Width="28" Height="18"
@ -6505,6 +6551,198 @@
</Canvas>
</GroupBox.Header>
<ui:SimpleStackPanel Spacing="6">
<WrapPanel Orientation="Horizontal">
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarShapes"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" 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="#fafafa" Text="显示“形状”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarFreeze"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M12.875,3.42617C12.875,2.94292 12.4833,2.55117 12,2.55117 11.5168,2.55117 11.125,2.94292 11.125,3.42617L11.125,4.58253 10.6766,4.35831C10.2444,4.1422 9.71878,4.31739 9.50266,4.74962 9.28655,5.18185 9.46174,5.70744 9.89398,5.92356L11.125,6.53909 11.125,8.48547 9.39973,9.48835 7.70825,8.51174 7.79073,7.13797C7.81969,6.65559 7.45212,6.24107 6.96974,6.21211 6.48736,6.18315 6.07283,6.55072 6.04387,7.0331L6.01383,7.53344 5.01252,6.95531C4.59401,6.71368 4.05887,6.85707 3.81724,7.27557 3.57561,7.69407 3.71899,8.22922 4.1375,8.47085L5.13889,9.04902 4.72043,9.3253C4.31715,9.59156 4.20607,10.1343 4.47233,10.5376 4.73859,10.9409 5.28136,11.052 5.68464,10.7857L6.83331,10.0273 8.51897,11.0006 8.52474,12.9961 6.83321,13.9727 5.68464,13.2144C5.28136,12.9481 4.73859,13.0592 4.47233,13.4625 4.20607,13.8658 4.31715,14.4085 4.72043,14.6748L5.13879,14.951 4.1375,15.5291C3.71899,15.7708 3.57561,16.3059 3.81724,16.7244 4.05887,17.1429 4.59401,17.2863 5.01252,17.0447L6.01383,16.4665 6.04387,16.967C6.07283,17.4494 6.48736,17.8169 6.96974,17.788 7.45212,17.759 7.81969,17.3445 7.79073,16.8621L7.70825,15.4882 9.39365,14.5151 11.125,15.5078 11.125,17.4609 9.89398,18.0764C9.46174,18.2925 9.28655,18.8181 9.50266,19.2503 9.71878,19.6826 10.2444,19.8578 10.6766,19.6417L11.125,19.4174 11.125,20.5738C11.125,21.0571 11.5168,21.4488 12,21.4488 12.4833,21.4488 12.875,21.0571 12.875,20.5738L12.875,19.4174 13.3235,19.6417C13.7557,19.8578 14.2813,19.6826 14.4974,19.2503 14.7136,18.8181 14.5384,18.2925 14.1061,18.0764L12.875,17.4609 12.875,15.5145 14.6003,14.5116 16.2918,15.4883 16.2094,16.8621C16.1804,17.3445 16.548,17.759 17.0304,17.788 17.5127,17.8169 17.9273,17.4494 17.9562,16.967L17.9863,16.4666 18.9875,17.0447C19.406,17.2863 19.9411,17.1429 20.1828,16.7244 20.4244,16.3059 20.281,15.7708 19.8625,15.5291L18.8612,14.951 19.2797,14.6748C19.6829,14.4085 19.794,13.8658 19.5278,13.4625 19.2615,13.0592 18.7187,12.9481 18.3154,13.2144L17.1668,13.9727 15.4808,12.9993 15.475,11.0039 17.1666,10.0272 18.3154,10.7857C18.7187,11.052 19.2615,10.9409 19.5278,10.5376 19.794,10.1343 19.6829,9.59156 19.2797,9.3253L18.8611,9.04892 19.8623,8.47085C20.2808,8.22922 20.4242,7.69407 20.1825,7.27557 19.9409,6.85707 19.4058,6.71368 18.9873,6.95531L17.9862,7.53326 17.9562,7.0331C17.9273,6.55072 17.5127,6.18315 17.0304,6.21211 16.548,6.24107 16.1804,6.65559 16.2094,7.13797L16.2918,8.51156 14.6062,9.48476 12.875,8.49221 12.875,6.5391 14.1061,5.92356C14.5384,5.70744 14.7136,5.18185 14.4974,4.74962 14.2813,4.31739 13.7557,4.1422 13.3235,4.35831L12.875,4.58254 12.875,3.42617z M10.269,11.0072L10.2748,13.0031 12.0058,13.9955 13.7308,12.9929 13.725,10.9967 11.9942,10.0044 10.269,11.0072z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fafafa" Text="显示“冻结”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarHand"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M8.26625,10.5636L8.26625,4.76409C8.26625,4.19587 8.49174,3.65469 8.89762,3.24882 9.70937,2.43706 11.1164,2.43706 11.9282,3.24882 12.3341,3.65469 12.5595,4.18685 12.5595,4.76409L12.5595,7.22542C13.2811,7.04372 14.0969,7.22143 14.634,7.75858 14.7741,7.89866 14.8927,8.05378 14.9879,8.22061 15.7667,7.91427 16.7334,8.06091 17.3399,8.66052 17.4846,8.80521 17.6063,8.96596 17.7031,9.13907 18.4771,8.84678 19.4284,8.99693 20.0277,9.58954 20.4336,9.99541 20.6591,10.5276 20.6591,11.1048L20.6591,15.1636C20.6591,16.8232 20.0097,18.3745 18.8461,19.5471 17.6736,20.7196 16.1222,21.36 14.4627,21.36L14.4717,21.342 12.6678,21.342 12.5595,21.342C11.6395,21.2969 10.7286,21.0443 9.9078,20.6114 9.00585,20.1243 8.23017,19.4208 7.67096,18.564L7.49057,18.2934C7.20195,17.8424 6.21882,16.1377 4.49609,13.0801 4.22551,12.593 4.15335,12.0248 4.28864,11.4836 4.43296,10.9425 4.7757,10.4825 5.25373,10.1938 5.72275,9.91424 6.28196,9.79698 6.82313,9.86012 7.37332,9.93228 7.87841,10.1758 8.26625,10.5636z M16.3838,11.2756L16.3838,11.5287C16.3838,11.9707 16.7446,12.3224 17.1775,12.3224 17.6195,12.3224 17.9712,11.9617 17.9712,11.5287L17.9712,10.9579C17.9953,10.8643 18.0434,10.7801 18.1156,10.708 18.323,10.5005 18.7018,10.5005 18.9093,10.708 19.0085,10.8162 19.0716,10.9515 19.0716,11.1048L19.0716,15.1636C19.0716,16.3993 18.5936,17.5538 17.7187,18.4287 16.8528,19.3036 15.6893,19.7816 14.4536,19.7816L12.8391,19.7816C12.0725,19.7816 11.3148,19.5922 10.6474,19.2314 9.97094,18.8706 9.39369,18.3385 8.97879,17.7071L8.7984,17.4365C8.52782,17.0216 7.53567,15.2989 5.85804,12.3134 5.78588,12.1781 5.76784,12.0338 5.80392,11.8895 5.84,11.7452 5.9302,11.6189 6.05647,11.5468 6.22784,11.4476 6.42627,11.4115 6.6247,11.4295 6.82313,11.4476 7.00352,11.5468 7.14783,11.6821L8.4737,13.0079C8.72783,13.2621 9.11822,13.3056 9.41903,13.1385 9.67804,13.0065 9.85369,12.7366 9.85369,12.4307L9.85369,4.76409C9.85369,4.61076 9.9078,4.47547 10.016,4.36724 10.2235,4.15077 10.5933,4.15077 10.8098,4.36724 10.918,4.47547 10.9721,4.61076 10.9721,4.76409L10.9721,9.26642 10.9721,9.27386 10.9721,11.0778 10.9721,11.0824 10.9721,11.5287C10.9721,11.9707 11.3239,12.3224 11.7658,12.3224 12.2078,12.3224 12.5595,11.9617 12.5595,11.5287L12.5595,9.26969C12.5605,9.11807 12.6146,8.98425 12.7219,8.877 12.9293,8.66955 13.3081,8.66955 13.5156,8.877 13.6148,8.98523 13.6779,9.12052 13.6779,9.27386L13.6779,11.5287C13.6779,11.9707 14.0387,12.3225 14.4717,12.3225 14.9136,12.3225 15.2654,11.9617 15.2654,11.5287L15.2654,10.1775 15.2654,10.1758C15.2654,10.0225 15.3195,9.88717 15.4277,9.77894 15.6352,9.57149 16.014,9.57149 16.2215,9.77894 16.3207,9.88717 16.3838,10.0225 16.3838,10.1758L16.3838,10.8276C16.3719,10.919 16.3658,11.0115 16.3658,11.1048 16.3658,11.1636 16.372,11.2207 16.3838,11.2756z M4.13531,6.54094C3.89178,6.54094 3.64826,6.43271 3.49493,6.21624 3.23336,5.86448 3.31454,5.36841 3.6663,5.11586 4.4059,4.57469 5.19961,4.11469 6.02941,3.74489 6.42627,3.5645 6.89528,3.74489 7.07567,4.14175 7.25606,4.53861 7.07567,5.00763 6.67881,5.18802 5.94823,5.51272 5.25373,5.9186 4.60433,6.38761 4.46001,6.48683 4.29766,6.54094 4.13531,6.54094z M17.3669,5.94565C17.5022,6.02683,17.6465,6.0629,17.7909,6.0629L17.7818,6.07192C18.0434,6.07192 18.296,5.93663 18.4493,5.70212 18.6838,5.33232 18.5756,4.84527 18.2058,4.61076 17.1144,3.91626 15.9238,3.39313 14.6701,3.05941 14.2552,2.95117 13.8133,3.1947 13.705,3.61862 13.5968,4.04253 13.8403,4.47547 14.2642,4.5837 15.3556,4.88135 16.4019,5.34134 17.3669,5.94565z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fafafa" Text="显示“漫游”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarUndo"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F1 M24,24z M0,0z M9.70711,6.70711C10.0976,6.31658 10.0976,5.68342 9.70711,5.29289 9.31658,4.90237 8.68342,4.90237 8.29289,5.29289L4.29289,9.29289C3.90237,9.68342,3.90237,10.3166,4.29289,10.7071L8.29289,14.7071C8.68342,15.0976 9.31658,15.0976 9.70711,14.7071 10.0976,14.3166 10.0976,13.6834 9.70711,13.2929L7.40633,10.9921 16,11C16.7956,11 17.5587,11.3161 18.1213,11.8787 18.6839,12.4413 19,13.2044 19,14 19,14.7956 18.6839,15.5587 18.1213,16.1213 17.5587,16.6839 16.7956,17 16,17L15,17C14.4477,17 14,17.4477 14,18 14,18.5523 14.4477,19 15,19L16,19C17.3261,19 18.5979,18.4732 19.5355,17.5355 20.4732,16.5979 21,15.3261 21,14 21,12.6739 20.4732,11.4021 19.5355,10.4645 18.5979,9.52678 17.3261,9 16,9L7.40633,9.00789 9.70711,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fafafa" Text="显示“撤销”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarRedo"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F1 M24,24z M0,0z M15.2929,6.70711C14.9024,6.31658 14.9024,5.68342 15.2929,5.29289 15.6834,4.90237 16.3166,4.90237 16.7071,5.29289L20.7071,9.29289C21.0976,9.68342,21.0976,10.3166,20.7071,10.7071L16.7071,14.7071C16.3166,15.0976 15.6834,15.0976 15.2929,14.7071 14.9024,14.3166 14.9024,13.6834 15.2929,13.2929L17.5937,10.9921 9,11C8.20435,11 7.44129,11.3161 6.87868,11.8787 6.31607,12.4413 6,13.2044 6,14 6,14.7956 6.31607,15.5587 6.87868,16.1213 7.44129,16.6839 8.20435,17 9,17L10,17C10.5523,17 11,17.4477 11,18 11,18.5523 10.5523,19 10,19L9,19C7.67392,19 6.40215,18.4732 5.46447,17.5355 4.52679,16.5979 4,15.3261 4,14 4,12.6739 4.52678,11.4021 5.46447,10.4645 6.40215,9.52678 7.67392,9 9,9L17.5937,9.00789 15.2929,6.70711z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fafafa" Text="显示“重做”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarCAM"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<StackPanel Orientation="Horizontal">
<Image RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Center" Height="17">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
<GeometryDrawing Brush="White" Geometry="F0 M24,24z M0,0z M11.5007,11.0214C11.5007,10.674,11.7823,10.3923,12.1298,10.3923L14.2967,10.3923 14.2967,9.90299C14.2967,9.41878 14.5325,8.98723 14.8305,8.68924 15.1285,8.39124 15.56,8.15547 16.0442,8.15547L18.281,8.15547C18.7652,8.15547 19.1968,8.39124 19.4948,8.68924 19.7928,8.98723 20.0286,9.41878 20.0286,9.90299L20.0286,10.3923 22.1955,10.3923C22.5429,10.3923 22.8246,10.674 22.8246,11.0214 22.8246,11.3688 22.5429,11.6505 22.1955,11.6505L21.7062,11.6505 21.7062,18.8503C21.7062,19.3345 21.4704,19.766 21.1724,20.064 20.8744,20.362 20.4429,20.5978 19.9587,20.5978L14.3666,20.5978C13.8824,20.5978 13.4508,20.362 13.1528,20.064 12.8549,19.766 12.6191,19.3345 12.6191,18.8503L12.6191,11.6505 12.1298,11.6505C11.7823,11.6505,11.5007,11.3688,11.5007,11.0214z M14.0425,19.1743C13.9211,19.0529,13.8773,18.9253,13.8773,18.8503L13.8773,11.6505 20.448,11.6505 20.448,18.8503C20.448,18.9253 20.4041,19.0529 20.2827,19.1743 20.1613,19.2958 20.0337,19.3396 19.9587,19.3396L14.3666,19.3396C14.2916,19.3396,14.1639,19.2958,14.0425,19.1743z M15.5549,9.90299C15.5549,9.82799 15.5987,9.70034 15.7202,9.57893 15.8416,9.45752 15.9692,9.41368 16.0442,9.41368L18.281,9.41368C18.356,9.41368 18.4837,9.45752 18.6051,9.57893 18.7265,9.70034 18.7703,9.82799 18.7703,9.90299L18.7703,10.3923 15.5549,10.3923 15.5549,9.90299z M18.9101,13.8174C18.9101,13.47 18.6285,13.1883 18.281,13.1883 17.9336,13.1883 17.6519,13.47 17.6519,13.8174L17.6519,17.1727C17.6519,17.5201 17.9336,17.8018 18.281,17.8018 18.6285,17.8018 18.9101,17.5201 18.9101,17.1727L18.9101,13.8174z M16.6733,13.8174C16.6733,13.47 16.3917,13.1883 16.0442,13.1883 15.6968,13.1883 15.4151,13.47 15.4151,13.8174L15.4151,17.1727C15.4151,17.5201 15.6968,17.8018 16.0442,17.8018 16.3917,17.8018 16.6733,17.5201 16.6733,17.1727L16.6733,13.8174z M1.32567,3.55246C1.47265,3.40549,1.69379,3.36174,1.88566,3.44167L11.8342,7.58639C12.0311,7.66845 12.1567,7.86389 12.1495,8.07716 12.1424,8.29043 12.0039,8.47698 11.8018,8.54561L8.25047,9.75183 11.4309,12.9323C11.6313,13.1326 11.6313,13.4574 11.4309,13.6577 11.2306,13.8581 10.9058,13.8581 10.7055,13.6577L7.52503,10.4773 6.31881,14.0286C6.25019,14.2307 6.06364,14.3692 5.85037,14.3763 5.6371,14.3835 5.44166,14.2579 5.3596,14.0609L1.21488,4.11245C1.13494,3.92058,1.1787,3.69944,1.32567,3.55246z" />
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
<TextBlock Foreground="#fafafa" Text="显示“清并鼠”按钮"
FontSize="14" VerticalAlignment="Center"
Margin="3,0,24,0" />
</StackPanel>
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarLasso"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<TextBlock Foreground="#fafafa" Text="显示“框选”按钮"
VerticalAlignment="Center" FontSize="14"
Margin="0,0,24,0" />
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarWhiteboard"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<TextBlock Foreground="#fafafa" Text="显示“白板”按钮"
VerticalAlignment="Center" FontSize="14"
Margin="0,0,24,0" />
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarFold"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<TextBlock Foreground="#fafafa" Text="显示“隐藏”按钮"
VerticalAlignment="Center" FontSize="14"
Margin="0,0,24,0" />
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox IsChecked="True" Name="CheckboxEnableFloatingBarGesture"
Checked="CheckboxFloatingBarIconsVisibility_CheckedChanged"
Unchecked="CheckboxFloatingBarIconsVisibility_CheckedChanged">
<CheckBox.Content>
<TextBlock Foreground="#fafafa" Text="显示“手势”按钮"
VerticalAlignment="Center" FontSize="14"
Margin="0,0,24,0" />
</CheckBox.Content>
</CheckBox>
</ui:SimpleStackPanel>
</WrapPanel>
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0"
Stroke="#3f3f46" StrokeThickness="1" Margin="0,4,0,4" />
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock Foreground="#fafafa" Text="浮动工具栏显示按钮文字"
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />

View File

@ -23,6 +23,7 @@ using Ink_Canvas.Popups;
using iNKORE.UI.WPF.Modern.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using Vanara.PInvoke;
using Application = System.Windows.Application;
using Button = System.Windows.Controls.Button;
using TextBox = System.Windows.Controls.TextBox;
@ -143,6 +144,7 @@ namespace Ink_Canvas {
drawingAttributes.FitToCurve = Settings.Canvas.FitToCurve;
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
inkCanvas.DeleteKeyCommandFired += InkCanvasDeleteCommandFiredEvent;
//inkCanvas.Gesture += InkCanvas_Gesture;
}
catch { }
@ -196,7 +198,7 @@ namespace Ink_Canvas {
const uint MF_GRAYED = 0x00000001;
const uint SC_CLOSE = 0xF060;
private static void PreloadIALibrary(object state) {
private static void PreloadIALibrary() {
GC.KeepAlive(typeof(InkAnalyzer));
GC.KeepAlive(typeof(AnalysisAlternate));
GC.KeepAlive(typeof(InkDrawingNode));
@ -242,7 +244,7 @@ namespace Ink_Canvas {
BoardBackgroundPopup.Visibility = Visibility.Collapsed;
// 提前加载IA库优化第一笔等待时间
ThreadPool.QueueUserWorkItem(PreloadIALibrary);
PreloadIALibrary();
SystemEvents.DisplaySettingsChanged += SystemEventsOnDisplaySettingsChanged;
@ -263,6 +265,10 @@ namespace Ink_Canvas {
SelectionV2Init();
InitStorageManagementModule();
InitFreezeWindow(new HWND[] {
new HWND(new WindowInteropHelper(this).Handle)
});
}
private void SystemEventsOnDisplaySettingsChanged(object sender, EventArgs e) {
@ -318,7 +324,10 @@ namespace Ink_Canvas {
}
if (e.Cancel) LogHelper.WriteLogToFile("Ink Canvas closing cancelled", LogHelper.LogType.Event);
else Application.Current.Shutdown();
else {
DisposeFreezeFrame();
Application.Current.Shutdown();
}
}
[DllImport("user32.dll", SetLastError = true)]

View File

@ -116,6 +116,10 @@ namespace Ink_Canvas {
/// 控制是否顯示浮動工具欄的“手勢”按鈕
/// </summary>
private void CheckEnableTwoFingerGestureBtnVisibility(bool isVisible) {
if (CheckboxEnableFloatingBarGesture.IsChecked == false) {
EnableTwoFingerGestureBorder.Visibility = Visibility.Collapsed;
return;
}
if (StackPanelCanvasControls.Visibility != Visibility.Visible
|| BorderFloatingBarMainControls.Visibility != Visibility.Visible) {
EnableTwoFingerGestureBorder.Visibility = Visibility.Collapsed;
@ -319,15 +323,15 @@ namespace Ink_Canvas {
if (mode != null && autoAlignCenter) {
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) {
await Task.Delay(1);
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(60);
} else if (Topmost == true) //非黑板
{
await Task.Delay(1);
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(100, true);
} else //黑板
{
await Task.Delay(1);
await Task.Delay(10);
ViewboxFloatingBarMarginAnimation(60);
}
}
@ -336,7 +340,7 @@ namespace Ink_Canvas {
PenPaletteV2Popup.IsOpen = false;
SelectionPopupV2.IsOpen = false;
await Task.Delay(10);
await Task.Delay(20);
isHidingSubPanelsWhenInking = false;
}
@ -646,6 +650,54 @@ namespace Ink_Canvas {
iconLabelsWhiteboard[wmi].Foreground = new SolidColorBrush(Colors.GhostWhite);
}
FloatingbarFreezeBtnBGCanvas.Visibility = mode != ICCToolsEnum.CursorMode ? Visibility.Visible : Visibility.Collapsed;
if (mode == ICCToolsEnum.CursorMode) IsAnnotationFreezeOn = false;
}
#endregion
#region
private bool _isAnnotationFreezeOn { get; set; } = false;
private bool IsAnnotationFreezeOn {
get => _isAnnotationFreezeOn;
set {
_isAnnotationFreezeOn = value;
UpdateFloatingBarFreezeIconCheckedStatus();
var t = new Thread(() => {
ApplyFreezeFrame();
});
t.Start();
}
}
private async void ApplyFreezeFrame() {
if (!isFreezeFrameLoaded) return;
if (_isAnnotationFreezeOn) {
var bmp = await GetFreezedFrameAsync();
Dispatcher.InvokeAsync(() => {
FreezeFrameBackgroundImage.Source = BitmapToImageSource(bmp);
FreezeFrameBackgroundImage.Visibility = Visibility.Visible;
});
} else {
Dispatcher.InvokeAsync(() => {
FreezeFrameBackgroundImage.Source = null;
FreezeFrameBackgroundImage.Visibility = Visibility.Collapsed;
});
}
}
private void UpdateFloatingBarFreezeIconCheckedStatus() {
if (IsAnnotationFreezeOn) {
FreezeIconGeometry.Brush = new SolidColorBrush(Colors.White);
FreezeToolbarTextBlock.Foreground = new SolidColorBrush(Colors.White);
FloatingbarFreezeBtnBG.Visibility = Visibility.Visible;
} else {
FreezeIconGeometry.Brush = new SolidColorBrush(Color.FromRgb(27, 27, 27));
FreezeToolbarTextBlock.Foreground = new SolidColorBrush(Colors.Black);
FloatingbarFreezeBtnBG.Visibility = Visibility.Hidden;
}
}
#endregion
@ -665,6 +717,14 @@ namespace Ink_Canvas {
}
}
private void FreezeFloatingBarBtn_MouseUp(object sender, MouseButtonEventArgs e) {
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == FreezeFloatingBarBtn && lastBorderMouseDownObject != FreezeFloatingBarBtn) return;
IsAnnotationFreezeOn = !IsAnnotationFreezeOn;
}
private async void CursorIcon_Click(object sender, RoutedEventArgs e)
{
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
@ -753,8 +813,8 @@ namespace Ink_Canvas {
((Panel)lastBorderMouseDownObject).Background = new SolidColorBrush(Colors.Transparent);
if (sender == Pen_Icon && lastBorderMouseDownObject != Pen_Icon) return;
if (Pen_Icon.Background == null || StackPanelCanvasControls.Visibility == Visibility.Collapsed)
{
if (Pen_Icon.Background == null || StackPanelCanvasControls.Visibility == Visibility.Collapsed) {
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
GridTransparencyFakeBackground.Opacity = 1;
@ -980,6 +1040,28 @@ namespace Ink_Canvas {
#region
public void UpdateFloatingBarIconsVisibility() {
var items = new FrameworkElement[] {
ShapeDrawFloatingBarBtn,
FreezeFloatingBarBtn,
HandFloatingBarBtn,
SymbolIconUndo,
SymbolIconRedo,
CursorWithDelFloatingBarBtn,
SymbolIconSelect,
WhiteboardFloatingBarBtn,
Fold_Icon,
EnableTwoFingerGestureBorder
};
var floatingBarIconsVisibilityValue = Settings.Appearance.FloatingBarIconsVisibility;
var fbivca = floatingBarIconsVisibilityValue.ToCharArray();
for (var i = 0; i < fbivca.Length; i++) {
items[i].Visibility = fbivca[i] == '1' ? Visibility.Visible : Visibility.Collapsed;
}
}
public void UpdateFloatingBarIconsLayout() {
FrameworkElement[] IconsArray = new FrameworkElement[13] {
Cursor_Icon,
@ -1388,10 +1470,10 @@ namespace Ink_Canvas {
private bool isViewboxFloatingBarMarginAnimationRunning = false;
public async void ViewboxFloatingBarMarginAnimation(int MarginFromEdge,
public void ViewboxFloatingBarMarginAnimation(int MarginFromEdge,
bool PosXCaculatedWithTaskbarHeight = false) {
if (MarginFromEdge == 60) MarginFromEdge = 55;
await Dispatcher.InvokeAsync(() => {
Dispatcher.InvokeAsync(() => {
if (Topmost == false)
MarginFromEdge = -60;
else
@ -1437,20 +1519,20 @@ namespace Ink_Canvas {
}
}
var sb = new Storyboard();
var marginAnimation = new ThicknessAnimation {
Duration = TimeSpan.FromSeconds(0.35),
Duration = TimeSpan.FromSeconds(0.20),
From = ViewboxFloatingBar.Margin,
To = new Thickness(pos.X, pos.Y, 0, -20)
};
marginAnimation.EasingFunction = new CircleEase();
ViewboxFloatingBar.BeginAnimation(MarginProperty, marginAnimation);
});
await Task.Delay(200);
await Dispatcher.InvokeAsync(() => {
ViewboxFloatingBar.Margin = new Thickness(pos.X, pos.Y, -2000, -200);
sb.Children.Add(marginAnimation);
Storyboard.SetTargetProperty(sb, new PropertyPath(FrameworkElement.MarginProperty));
sb.Completed += (sender, args) => {
ViewboxFloatingBar.Margin = new Thickness(pos.X, pos.Y, 0, -20);
if (Topmost == false) ViewboxFloatingBar.Visibility = Visibility.Hidden;
};
sb.Begin(ViewboxFloatingBar);
});
}

View File

@ -0,0 +1,169 @@
using OSVersionExtension;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Vanara.PInvoke;
namespace Ink_Canvas {
public partial class MainWindow : Window {
public IntPtr MagnificationWinHandle;
public IntPtr MagnificationHostWindowHandle;
public bool isFreezeFrameLoaded = false;
[DllImport("user32.dll")]
static extern bool UpdateWindow(IntPtr hWnd);
/// <summary>
/// 初始化画面定格窗口
/// </summary>
/// <param name="hwndsList"></param>
public void InitFreezeWindow(HWND[] hwndsList) {
isFreezeFrameLoaded = false;
if (OSVersion.GetOperatingSystem() < OSVersionExtension.OperatingSystem.Windows81) return;
if (!Magnification.MagInitialize()) return;
// 註冊宿主窗體類名
var wndClassEx = new WNDCLASSEX {
cbSize = (uint)Marshal.SizeOf<WNDCLASSEX>(), style = CS_HREDRAW | CS_VREDRAW,
lpfnWndProc = StaticWndProcDelegate, hInstance = IntPtr.Zero,
hCursor = LoadCursor(IntPtr.Zero, IDC_ARROW), hbrBackground = (IntPtr)(1 + COLOR_BTNFACE),
lpszClassName = "ICCMagnifierWindowHostForFreezeFrame",
hIcon = IntPtr.Zero, hIconSm = IntPtr.Zero
};
RegisterClassEx(ref wndClassEx);
// 創建宿主窗體
var windowHostHandle = CreateWindowEx(
WS_EX_TOPMOST | WS_EX_LAYERED, "ICCMagnifierWindowHostForFreezeFrame", "ICCMagnifierWindowHostWindowForFreezeFrame",
WS_SIZEBOX | WS_SYSMENU | WS_CLIPCHILDREN | WS_CAPTION | WS_MAXIMIZEBOX, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero,
IntPtr.Zero);
// 設定分層窗體
SetLayeredWindowAttributes(windowHostHandle, 0, 0, LWA_ALPHA);
// 創建放大鏡窗體
var hwndMag = CreateWindowEx(
0, Magnification.WC_MAGNIFIER, "ICCMagnifierWindowForFreezeFrame", WS_CHILD | WS_VISIBLE | MS_CLIPAROUNDCURSOR, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, windowHostHandle,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
// 設定窗體樣式和排布
int style = GetWindowLong(windowHostHandle, GWL_STYLE);
style &= ~WS_CAPTION; // 隐藏标题栏
style &= ~WS_THICKFRAME; // 禁止窗口拉伸
SetWindowLong(windowHostHandle, GWL_STYLE, style);
SetWindowPos(windowHostHandle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED);
// 設定額外樣式
int exStyle = GetWindowLong(windowHostHandle, GWL_EXSTYLE);
exStyle |= WS_EX_TOOLWINDOW; /* <- 隐藏任务栏图标 */
exStyle &= ~WS_EX_APPWINDOW;
SetWindowLong(windowHostHandle, GWL_EXSTYLE, exStyle);
// 导出成员
MagnificationWinHandle = hwndMag;
MagnificationHostWindowHandle = windowHostHandle;
// 設定放大鏡工廠
Magnification.MAGTRANSFORM matrix = new Magnification.MAGTRANSFORM();
matrix[0, 0] = 1.0f;
matrix[0, 1] = 0.0f;
matrix[0, 2] = 0.0f;
matrix[1, 0] = 0.0f;
matrix[1, 1] = 1.0f;
matrix[1, 2] = 0.0f;
matrix[2, 0] = 1.0f;
matrix[2, 1] = 0.0f;
matrix[2, 2] = 0.0f;
if (!Magnification.MagSetWindowTransform(hwndMag, matrix)) return;
// 設定放大鏡轉化矩乘陣列
Magnification.MAGCOLOREFFECT magEffect = new Magnification.MAGCOLOREFFECT();
magEffect[0, 0] = 1.0f;
magEffect[0, 1] = 0.0f;
magEffect[0, 2] = 0.0f;
magEffect[0, 3] = 0.0f;
magEffect[0, 4] = 0.0f;
magEffect[1, 0] = 0.0f;
magEffect[1, 1] = 1.0f;
magEffect[1, 2] = 0.0f;
magEffect[1, 3] = 0.0f;
magEffect[1, 4] = 0.0f;
magEffect[2, 0] = 0.0f;
magEffect[2, 1] = 0.0f;
magEffect[2, 2] = 1.0f;
magEffect[2, 3] = 0.0f;
magEffect[2, 4] = 0.0f;
magEffect[3, 0] = 0.0f;
magEffect[3, 1] = 0.0f;
magEffect[3, 2] = 0.0f;
magEffect[3, 3] = 1.0f;
magEffect[3, 4] = 0.0f;
magEffect[4, 0] = 0.0f;
magEffect[4, 1] = 0.0f;
magEffect[4, 2] = 0.0f;
magEffect[4, 3] = 0.0f;
magEffect[4, 4] = 1.0f;
if (!Magnification.MagSetColorEffect(hwndMag, magEffect)) return;
// 顯示窗體
ShowWindow(windowHostHandle, SW_SHOW);
// 过滤窗口
var hwnds = new List<HWND> { hwndMag };
hwnds.AddRange(hwndsList);
if (!Magnification.MagSetWindowFilterList(hwndMag, Magnification.MW_FILTERMODE.MW_FILTERMODE_EXCLUDE,
hwnds.Count, hwnds.ToArray())) return;
// 设置窗口 Source
if (!Magnification.MagSetWindowSource(hwndMag, new RECT(0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height))) return;
InvalidateRect(hwndMag, IntPtr.Zero, true);
isFreezeFrameLoaded = true;
}
public async Task<bool> InitFreezeWindowAsync(HWND[] hwndsList) {
return await Task.Run(() => {
InitFreezeWindow(hwndsList);
return true;
});
}
public void DisposeFreezeFrame() {
// 反注册宿主窗口
UnregisterClass("ICCMagnifierWindowHostForFreezeFrame", IntPtr.Zero);
// 销毁宿主窗口
Magnification.MagUninitialize();
DestroyWindow(MagnificationHostWindowHandle);
}
public void SetFreezeFrameWindowsFilterList(HWND[] hwndsList) {
if (!isFreezeFrameLoaded) return;
var hwnds = new List<HWND> { MagnificationWinHandle };
hwnds.AddRange(hwndsList);
if (!Magnification.MagSetWindowFilterList(MagnificationWinHandle, Magnification.MW_FILTERMODE.MW_FILTERMODE_EXCLUDE,
hwnds.Count, hwnds.ToArray())) return;
}
public Bitmap GetFreezedFrame() {
if (!isFreezeFrameLoaded) return new Bitmap(1,1);
if (!Magnification.MagSetWindowSource(MagnificationWinHandle, new RECT(0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height))) return new Bitmap(1,1);
InvalidateRect(MagnificationWinHandle, IntPtr.Zero, true);
UpdateWindow(MagnificationHostWindowHandle);
RECT rect;
GetWindowRect(MagnificationWinHandle, out rect);
Bitmap bmp = new Bitmap(rect.Width, rect.Height);
Graphics memoryGraphics = Graphics.FromImage(bmp);
PrintWindow(MagnificationWinHandle, memoryGraphics.GetHdc(), PW_RENDERFULLCONTENT);
memoryGraphics.ReleaseHdc();
return bmp;
}
public async Task<Bitmap> GetFreezedFrameAsync() {
if (!isFreezeFrameLoaded) return null;
var result = await Task.Run(GetFreezedFrame);
return result;
}
}
}

View File

@ -1,22 +1,40 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Specialized;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Input.StylusPlugIns;
using System.Windows.Media;
namespace Ink_Canvas
{
namespace Ink_Canvas {
public class IccInkCanvas : InkCanvas {
public IccInkCanvas() {
// 通过反射移除InkCanvas自带的默认 Delete按键事件
var commandBindingsField =
typeof(CommandManager).GetField("_classCommandBindings", BindingFlags.NonPublic | BindingFlags.Static);
var bnds = commandBindingsField.GetValue(null) as HybridDictionary;
var inkCanvasBindings = bnds[typeof(InkCanvas)] as CommandBindingCollection;
var enumerator = inkCanvasBindings.GetEnumerator();
while (enumerator.MoveNext()) {
var item = (CommandBinding)enumerator.Current;
if (item.Command == ApplicationCommands.Delete) {
var executedField =
typeof(CommandBinding).GetField("Executed", BindingFlags.NonPublic | BindingFlags.Instance);
var canExecuteField =
typeof(CommandBinding).GetField("CanExecute", BindingFlags.NonPublic | BindingFlags.Instance);
executedField.SetValue(item, new ExecutedRoutedEventHandler((sender, args) => { }));
canExecuteField.SetValue(item, new CanExecuteRoutedEventHandler((sender, args) => { }));
}
}
}
// 为IccInkCanvas注册自定义的 Delete按键Command并Invoke OnDeleteCommandFired。
CommandManager.RegisterClassCommandBinding(typeof(IccInkCanvas), new CommandBinding(ApplicationCommands.Delete,
(sender, args) => {
DeleteKeyCommandFired?.Invoke(this, new RoutedEventArgs());
}, (sender, args) => {
args.CanExecute = GetSelectedStrokes().Count != 0;
}));
}
public event EventHandler<RoutedEventArgs> DeleteKeyCommandFired;
}
}

View File

@ -121,15 +121,6 @@ namespace Ink_Canvas {
// toolbutton
BorderStrokeSelectionToolButton_MouseLeave(sender, e);
// cancel
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
inkCanvas.Opacity = 1;
InkSelectionStrokesOverlay.Visibility = Visibility.Collapsed;
InkSelectionStrokesBackgroundInkCanvas.Visibility = Visibility.Collapsed;
InkSelectionStrokesOverlay.DrawStrokes(new StrokeCollection(), new Matrix());
UpdateStrokeSelectionBorder(false, null);
RectangleSelectionHitTestBorder.Visibility = Visibility.Visible;
}
@ -298,6 +289,10 @@ namespace Ink_Canvas {
CancelCurrentStrokesSelection();
}
private void InkCanvasDeleteCommandFiredEvent(object sender, RoutedEventArgs e) {
SymbolIconDelete_MouseUp(null, null);
}
private void RectangleSelectionHitTestBorder_MouseDown(object sender, MouseButtonEventArgs e) {
var pt = e.GetPosition(Main_Grid);
var nt = inkCanvas.Strokes.HitTest(pt, 8);

View File

@ -18,9 +18,12 @@ using System.Xml.Linq;
using iNKORE.UI.WPF.Modern.Media.Animation;
using System.Security.Principal;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Timers;
using ColorPicker.Models;
using Ink_Canvas.Popups;
using Ookii.Dialogs.Wpf;
using Microsoft.Office.Interop.PowerPoint;
@ -789,6 +792,38 @@ namespace Ink_Canvas {
SaveSettingsToFile();
}
private void CheckboxFloatingBarIconsVisibility_CheckedChanged(object sender, RoutedEventArgs e) {
if (!isLoaded) return;
var items = new CheckBox[] {
CheckboxEnableFloatingBarShapes,
CheckboxEnableFloatingBarFreeze,
CheckboxEnableFloatingBarHand,
CheckboxEnableFloatingBarUndo,
CheckboxEnableFloatingBarRedo,
CheckboxEnableFloatingBarCAM,
CheckboxEnableFloatingBarLasso,
CheckboxEnableFloatingBarWhiteboard,
CheckboxEnableFloatingBarFold,
CheckboxEnableFloatingBarGesture
};
if (!items.Contains((CheckBox)sender)) return;
if (Settings.Appearance.FloatingBarIconsVisibility.Length != 10) {
Settings.Appearance.FloatingBarIconsVisibility =
Settings.Appearance.FloatingBarIconsVisibility.PadRight(10, '1');
SaveSettingsToFile();
}
var value = Settings.Appearance.FloatingBarIconsVisibility;
var vsb = new StringBuilder(value);
vsb[Array.IndexOf(items, (CheckBox)sender)] = (bool)((CheckBox)sender).IsChecked ? '1' : '0';
Settings.Appearance.FloatingBarIconsVisibility = vsb.ToString();
UpdateFloatingBarIconsVisibility();
SaveSettingsToFile();
}
#endregion
#region Canvas
@ -1520,6 +1555,7 @@ namespace Ink_Canvas {
Settings.Advanced.IsEnableDPIChangeDetection = false;
Settings.Advanced.IsEnableResolutionChangeDetection = false;
Settings.Advanced.IsDisableCloseWindow = true;
Settings.Advanced.EnableForceTopMost = false;
Settings.Appearance.IsEnableDisPlayNibModeToggler = false;
Settings.Appearance.IsColorfulViewboxFloatingBar = false;
@ -1540,7 +1576,7 @@ namespace Ink_Canvas {
Settings.Appearance.ViewboxFloatingBarOpacityInPPTValue = 1.0;
Settings.Appearance.EnableTrayIcon = true;
Settings.Appearance.FloatingBarButtonLabelVisibility = true;
Settings.Advanced.EnableForceTopMost = false;
Settings.Appearance.FloatingBarIconsVisibility = "11111111";
Settings.Automation.IsAutoFoldInEasiNote = true;
Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno = true;
@ -1603,7 +1639,7 @@ namespace Ink_Canvas {
Settings.Canvas.HideStrokeWhenSelecting = false;
Settings.Canvas.ClearCanvasAndClearTimeMachine = false;
Settings.Canvas.FitToCurve = false;
Settings.Canvas.UsingWhiteboard = false;
//Settings.Canvas.UsingWhiteboard = false;
Settings.Canvas.HyperbolaAsymptoteOption = 0;
Settings.Canvas.BlackboardBackgroundColor = BlackboardBackgroundColorEnum.White;
Settings.Canvas.BlackboardBackgroundPattern = BlackboardBackgroundPatternEnum.None;

View File

@ -5,8 +5,10 @@ using Ookii.Dialogs.Wpf;
using OSVersionExtension;
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@ -326,6 +328,33 @@ namespace Ink_Canvas {
ToggleSwitchFloatingBarButtonLabelVisibility.IsOn =
Settings.Appearance.FloatingBarButtonLabelVisibility;
var items = new CheckBox[] {
CheckboxEnableFloatingBarShapes,
CheckboxEnableFloatingBarFreeze,
CheckboxEnableFloatingBarHand,
CheckboxEnableFloatingBarUndo,
CheckboxEnableFloatingBarRedo,
CheckboxEnableFloatingBarCAM,
CheckboxEnableFloatingBarLasso,
CheckboxEnableFloatingBarWhiteboard,
CheckboxEnableFloatingBarFold,
CheckboxEnableFloatingBarGesture
};
if (Settings.Appearance.FloatingBarIconsVisibility.Length != 10) {
Settings.Appearance.FloatingBarIconsVisibility =
Settings.Appearance.FloatingBarIconsVisibility.PadRight(10, '1');
SaveSettingsToFile();
}
var floatingBarIconsVisibilityValue = Settings.Appearance.FloatingBarIconsVisibility;
var fbivca = floatingBarIconsVisibilityValue.ToCharArray();
for (var i = 0; i < fbivca.Length; i++) {
items[i].IsChecked = fbivca[i] == '1';
}
UpdateFloatingBarIconsVisibility();
FloatingBarTextVisibilityBindingLikeAPieceOfShit.Visibility = Settings.Appearance.FloatingBarButtonLabelVisibility ? Visibility.Visible : Visibility.Collapsed;
SystemEvents_UserPreferenceChanged(null, null);
@ -631,6 +660,11 @@ namespace Ink_Canvas {
ToggleSwitchIsEnableAutoConvertInkColorWhenBackgroundChanged.IsOn =
Settings.Canvas.IsEnableAutoConvertInkColorWhenBackgroundChanged;
ComboBoxSelectionMethod.SelectedIndex = Settings.Canvas.SelectionMethod;
ToggleSwitchAllowClickToSelectLockedStroke.IsOn = Settings.Canvas.AllowClickToSelectLockedStroke;
ToggleSwitchOnlyHitTestFullyContainedStrokes.IsOn = Settings.Canvas.OnlyHitTestFullyContainedStrokes;
ToggleSwitchApplyScaleToStylusTip.IsOn = Settings.Canvas.ApplyScaleToStylusTip;
} else {
Settings.Canvas = new Canvas();
}

View File

@ -167,7 +167,7 @@ namespace Ink_Canvas.Popups
return result;
}
private BitmapImage BitmapToImageSource(Bitmap bitmap)
public BitmapImage BitmapToImageSource(Bitmap bitmap)
{
using (MemoryStream memory = new MemoryStream())
{

View File

@ -230,9 +230,10 @@ namespace Ink_Canvas
public bool IsShowModeFingerToggleSwitch { get; set; } = true;
[JsonProperty("theme")]
public int Theme { get; set; } = 0;
[JsonProperty("floatingBarButtonLabelVisibility")]
public bool FloatingBarButtonLabelVisibility = true;
[JsonProperty("FloatingBarIconsVisibility")]
public string FloatingBarIconsVisibility = "11111111";
}
public class PowerPointSettings