InkCanvasForClass/Ink Canvas/MainWindow.xaml

227 lines
19 KiB
Plaintext
Raw Normal View History

2020-11-22 11:05:12 +08:00
<Window x:Class="Ink_Canvas.MainWindow"
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"
2021-09-09 13:12:34 +08:00
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Topmost="True" KeyDown="Window_KeyDown"
xmlns:local="clr-namespace:Ink_Canvas" xmlns:ui="http://schemas.modernwpf.com/2019" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize"
2020-11-22 11:05:12 +08:00
mc:Ignorable="d" WindowState="Maximized" Loaded="Window_Loaded" Background="Transparent" ShowInTaskbar="False"
2021-09-12 20:12:16 +08:00
Title="MainWindow" Height="1000" Width="800" FontFamily="Microsoft YaHei UI"
2021-09-10 01:35:39 +08:00
Foreground="Black">
2020-11-22 11:05:12 +08:00
<!--资源中添加命令-->
<Window.Resources>
2021-09-09 13:12:34 +08:00
<RoutedUICommand x:Key="KeyExit" Text=" "/>
2020-11-22 11:05:12 +08:00
<RoutedUICommand x:Key="back_HotKey_Command" Text=" "/>
</Window.Resources>
<!--输入命令绑定-->
<Window.InputBindings>
2021-09-09 13:12:34 +08:00
<KeyBinding Gesture="Shift+Esc" Command="{StaticResource KeyExit}"/>
2020-11-22 11:05:12 +08:00
<KeyBinding Modifiers="Ctrl" Key="Z" Command="{StaticResource back_HotKey_Command}"/>
</Window.InputBindings>
<!--命令执行方法绑定-->
<Window.CommandBindings>
<CommandBinding Command="{StaticResource back_HotKey_Command}"
CanExecute="CommandBinding_CanExecute"
Executed="back_HotKey"/>
2021-09-09 13:12:34 +08:00
<CommandBinding Command="{StaticResource KeyExit}"
CanExecute="CommandBinding_CanExecute"
Executed="KeyExit"/>
2020-11-22 11:05:12 +08:00
</Window.CommandBindings>
2021-09-09 13:12:34 +08:00
<Grid x:Name="Main_Grid" Background="#01FFFFFF" TouchDown="Main_Grid_TouchDown">
2021-09-11 01:23:03 +08:00
<Grid Name="GridBackgroundCoverHolder">
<Grid Name="GridBackgroundCover" Visibility="Hidden" Background="#FFF2F2F2"/>
</Grid>
2021-09-10 01:35:39 +08:00
<Label Name="Label" Visibility="Collapsed" Content="0"/>
2021-09-11 01:23:03 +08:00
<InkCanvas Name="inkCanvas" Background="Transparent">
<!--<InkCanvas.DefaultDrawingAttributes>
<DrawingAttributes StylusTip="Ellipse" Height="8" Width="4" IgnorePressure="False" FitToCurve="True" >
<DrawingAttributes.StylusTipTransform>
<Matrix M11="1" M12="1.5" M21="2.2" M22="1"/>
</DrawingAttributes.StylusTipTransform>
</DrawingAttributes>
</InkCanvas.DefaultDrawingAttributes>-->
</InkCanvas>
2021-09-12 18:28:26 +08:00
<Border Name="BorderSettings" Background="White" BorderBrush="Black"
BorderThickness="1" CornerRadius="10"
2021-09-18 00:10:16 +08:00
Width="400" HorizontalAlignment="Center"
2021-09-17 23:09:00 +08:00
Margin="100" Visibility="Visible">
2021-09-12 18:28:26 +08:00
<ScrollViewer VerticalScrollBarVisibility="Auto"
PanningMode="VerticalOnly" ui:ThemeManager.RequestedTheme="Light"
ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback">
<StackPanel Margin="20">
<TextBlock Text="设置" FontSize="26" Margin="0,0,0,12"/>
2021-09-18 00:10:16 +08:00
<!--<Viewbox Margin="0,-55,0,0" Height="60" HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal">
<Image Source="logo.png" Width="120"/>
<Image Source="text.png" Width="200"/>
</StackPanel>
</Viewbox>-->
<Viewbox Visibility="{Binding ElementName=GroupBoxMASEZVersion, Path=Visibility}" Margin="0,-58,0,0" Height="45" HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal">
<Image Source="textCN.png" Width="200"/>
<TextBlock Text="专版" FontSize="32" Foreground="#C30F2C" VerticalAlignment="Center"/>
</StackPanel>
</Viewbox>
2021-09-12 18:28:26 +08:00
<TextBlock FontSize="14" Margin="0,0,0,0"
Text="*设置将自动保存,再次点击“设置”按钮将关闭此页面。"/>
<TextBlock FontSize="14" Margin="0,0,0,12"
Text="*部分设置可能需要重新打开后生效。"/>
<GroupBox Header="行为">
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchRunAtStartup" Header="开机时运行" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchRunAtStartup_Toggled"/>
<TextBlock Text="我们并不推荐使用 WPS Office因为其对于触摸设备的较差支持。" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchSupportPowerPoint" Header="Microsoft PowerPoint 支持" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchSupportPowerPoint_Toggled"/>
2021-09-18 00:10:16 +08:00
<TextBlock Text="对 WPS Office 支持时会导致 WPS Office 关闭时卡顿,故禁用。" Foreground="#666666"/>
2021-09-17 23:09:00 +08:00
<ui:ToggleSwitch Name="ToggleSwitchSupportWPS" Header="WPS Office 支持" IsOn="False" IsEnabled="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchSupportPowerPoint_Toggled"/>
2021-09-12 18:28:26 +08:00
<ui:ToggleSwitch Name="ToggleSwitchShowCanvasAtNewSlideShow" Header="开始放映时自动显示画板" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowCanvasAtNewSlideShow_Toggled"/>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="启动">
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchAutoHideCanvas" Header="自动隐藏画板" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoHideCanvas_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchAutoEnterModeFinger" Header="自动进入手指模式" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchAutoEnterModeFinger_Toggled"/>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="外观">
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchShowButtonExit" Header="显示“退出”按钮" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowButtonExit_Toggled"/>
2021-09-12 20:12:16 +08:00
<Button Content="立即退出" Width="120" FontFamily="Microsoft YaHei UI" Click="BtnExit_Click" Margin="0,0,0,10"/>
2021-09-12 18:28:26 +08:00
<ui:ToggleSwitch Name="ToggleSwitchShowButtonEraser" Header="显示“橡皮”按钮" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowButtonEraser_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchShowButtonHideControl" Header="显示“⇅ (显示或隐藏控制按钮)”按钮" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowButtonHideControl_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchShowButtonLRSwitch" Header="显示“⇆ (左右切换)”按钮" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowButtonLRSwitch_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchShowButtonModeFinger" Header="显示“手指模式”切换按钮" IsOn="True" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchShowButtonModeFinger_Toggled"/>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="关于">
<ui:SimpleStackPanel Spacing="12">
2021-09-18 00:10:16 +08:00
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<TextBlock FontSize="14">
<Bold>当前版本:</Bold>
</TextBlock>
<TextBlock FontSize="14" Text="" Name="TextBlockVersion"/>
</ui:SimpleStackPanel>
2021-09-12 18:28:26 +08:00
<TextBlock FontSize="14">
<Bold>开发者:</Bold> XY Wang (WXRIW)
</TextBlock>
<TextBlock FontSize="14">
<Bold>开源地址:</Bold>
<Hyperlink Click="HyperlinkSource_Click">
<TextBlock Text="https://github.com/WXRIW/Ink-Canvas"></TextBlock>
</Hyperlink>
</TextBlock>
<TextBlock FontSize="14">
<Bold>开源协议:</Bold> GNU General Public License v3.0
</TextBlock>
</ui:SimpleStackPanel>
</GroupBox>
2021-09-18 00:10:16 +08:00
<GroupBox Name="GroupBoxMASEZVersion" Visibility="Collapsed"
Header="马鞍山二中专版说明">
<ui:SimpleStackPanel Spacing="12">
<TextBlock Name="TextBlockMASEZNotice" FontSize="14" Margin="0,0,0,0"/>
<Viewbox Margin="0,0,0,0" Height="70" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal">
<Image Source="logo.png" Width="120"/>
<Image Source="text.png" Width="200"/>
</StackPanel>
</Viewbox>
</ui:SimpleStackPanel>
</GroupBox>
2021-09-12 18:28:26 +08:00
</StackPanel>
</ScrollViewer>
</Border>
2021-09-11 01:23:03 +08:00
<StackPanel Name="StackPanelMain" Margin="10,0,10,55"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="46">
2021-09-09 13:12:34 +08:00
<StackPanel Name="StackPanelControl">
<Button Name="BtnExit" Content="退出" FontFamily="Microsoft YaHei UI"
2021-09-12 18:28:26 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnExit_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<Button Name="BtnSettings" Content="设置" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnSettings_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-12 13:18:10 +08:00
<TextBlock Text="自动&#x000A;粗细" Visibility="Collapsed" Margin="0,10,0,0"
2021-09-11 01:23:03 +08:00
FontSize="14" HorizontalAlignment="Center"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-12 13:18:10 +08:00
<Viewbox Height="30" Visibility="Collapsed">
<ui:ToggleSwitch Name="ToggleSwitchAutoWeight" Header="" Width="40.5"
2021-09-11 01:23:03 +08:00
FontFamily="Microsoft YaHei UI" FontSize="19"
OnContent="" OffContent="" Toggled="ToggleSwitchAutoWeight_Toggled"/>
</Viewbox>
2021-09-12 18:28:26 +08:00
<StackPanel Name="StackPanelModeFinger" Background="#01000000">
<TextBlock Text="手指&#x000A;模式" Margin="0,10,0,0"
2021-09-10 01:35:39 +08:00
FontSize="14" HorizontalAlignment="Center"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-12 18:28:26 +08:00
<Viewbox Height="30">
<ui:ToggleSwitch Name="ToggleSwitchModeFinger" Header="" Width="40.5"
2021-09-10 01:35:39 +08:00
FontFamily="Microsoft YaHei UI" FontSize="19"
2021-09-12 18:28:26 +08:00
OnContent="" OffContent="" Toggled="ToggleSwitchModeFinger_Toggled"/>
</Viewbox>
</StackPanel>
2021-09-11 01:23:03 +08:00
<Button Name="BtnThickness" Content="粗细" Visibility="Collapsed" FontFamily="Microsoft YaHei UI"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnThickness_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-12 18:28:26 +08:00
<Button Name="BtnErase" Content="橡皮" Visibility="Visible" FontFamily="Microsoft YaHei UI"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnErase_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-11 01:23:03 +08:00
<Button Name="BtnSwitchTheme" Content="深色" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnSwitchTheme_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-10 01:35:39 +08:00
<Button Name="BtnSwitch" Content="背景" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnSwitch_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-11 01:23:03 +08:00
<StackPanel Name="StackPanelColors" Margin="7,0,7,0">
2021-09-09 13:12:34 +08:00
<Button Name="BtnColorBlack" Content="" FontFamily="Microsoft YaHei UI" Background="Black"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorBlack_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-09 13:12:34 +08:00
<Button Name="BtnColorRed" Content="" FontFamily="Microsoft YaHei UI" Background="Red"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorRed_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-09 13:12:34 +08:00
<Button Name="BtnColorGreen" Content="" FontFamily="Microsoft YaHei UI" Background="#1ED760"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorGreen_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-09 13:12:34 +08:00
<Button Name="BtnColorBlue" Content="" FontFamily="Microsoft YaHei UI" Background="#239AD6"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorBlue_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-18 00:10:16 +08:00
<Button Name="BtnColorYellow" Content="" FontFamily="Microsoft YaHei UI" Background="#FFB900"
2021-09-10 01:35:39 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorYellow_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-09 13:12:34 +08:00
</StackPanel>
2021-09-11 01:23:03 +08:00
<Button Name="BtnClear" Content="清屏" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnClear_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-10 01:35:39 +08:00
<Button x:Name="BtnHideInkCanvas" Content="隐藏&#x000A;画板" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnHideInkCanvas_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-11 01:23:03 +08:00
<Button x:Name="BtnCheckPPT" Visibility="Collapsed" Content="检查" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnCheckPPT_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-12 13:18:10 +08:00
<Button x:Name="BtnPPTSlideShow" Visibility="Collapsed" Content="从头&#x000A;放映" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnPPTSlideShow_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<Button x:Name="BtnPPTSlideShowEnd" Visibility="Collapsed" Content="结束&#x000A;放映" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnPPTSlideShowEnd_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-11 01:23:03 +08:00
<StackPanel Name="StackPanelPPTControls" Visibility="Collapsed">
<Button x:Name="BtnPPTSlidesUp" Content="↑" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnPPTSlidesUp_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<Button x:Name="BtnPPTSlidesDown" Content="↓" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnPPTSlidesDown_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
</StackPanel>
2021-09-10 01:35:39 +08:00
<Button x:Name="BtnSwitchSide" Content="⇆" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnSwitchSide_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-09 13:12:34 +08:00
</StackPanel>
2021-09-10 01:35:39 +08:00
<Button x:Name="BtnHideControl" Content="⇅" FontFamily="Microsoft YaHei UI"
2021-09-09 13:12:34 +08:00
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
2021-09-10 01:35:39 +08:00
Click="BtnHideControl_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
2021-09-18 00:10:16 +08:00
<TextBlock Visibility="{Binding ElementName=GroupBoxMASEZVersion, Path=Visibility}" Text="二中专版" FontSize="11" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Image Visibility="{Binding ElementName=GroupBoxMASEZVersion, Path=Visibility}" Source="logo2.png" Margin="0,-5,0,-15"/>
2021-09-11 01:23:03 +08:00
<TextBlock Text="Developer" FontSize="8.5" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<TextBlock Text="XY Wang" FontSize="9" HorizontalAlignment="Center" Margin="0,3,0,0" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
2021-09-09 13:12:34 +08:00
</StackPanel>
2020-11-22 11:05:12 +08:00
</Grid>
</Window>