InkCanvasForClass/Ink Canvas/MainWindow.xaml
2021-09-22 00:20:27 +08:00

233 lines
20 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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"
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"
mc:Ignorable="d" WindowState="Maximized" Loaded="Window_Loaded" Background="Transparent" ShowInTaskbar="False"
Title="MainWindow" Height="1000" Width="800" FontFamily="Microsoft YaHei UI"
Foreground="Black" Closed="Window_Closed">
<!--资源中添加命令-->
<Window.Resources>
<RoutedUICommand x:Key="KeyExit" Text=" "/>
<RoutedUICommand x:Key="back_HotKey_Command" Text=" "/>
</Window.Resources>
<!--输入命令绑定-->
<Window.InputBindings>
<KeyBinding Gesture="Shift+Esc" Command="{StaticResource KeyExit}"/>
<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"/>
<CommandBinding Command="{StaticResource KeyExit}"
CanExecute="CommandBinding_CanExecute"
Executed="KeyExit"/>
</Window.CommandBindings>
<Grid x:Name="Main_Grid" Background="#01FFFFFF" TouchDown="Main_Grid_TouchDown">
<Grid Name="GridBackgroundCoverHolder">
<Grid Name="GridBackgroundCover" Visibility="Hidden" Background="#FFF2F2F2"/>
</Grid>
<Label Name="Label" Visibility="Collapsed" Content="0"/>
<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>
<Border Name="BorderSettings" Background="White" BorderBrush="Black"
BorderThickness="1" CornerRadius="10"
Width="400" HorizontalAlignment="Center"
Margin="100" Visibility="Visible">
<Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto"
PanningMode="VerticalOnly" ui:ThemeManager.RequestedTheme="Light"
ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback">
<StackPanel Margin="20,70,20,20">
<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"/>
<TextBlock Text="对 WPS Office 支持时会导致 WPS Office 关闭时卡顿,故禁用。" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchSupportWPS" Header="WPS Office 支持" IsOn="False" IsEnabled="False" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchSupportPowerPoint_Toggled"/>
<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"/>
<Button Content="立即退出" Width="120" FontFamily="Microsoft YaHei UI" Click="BtnExit_Click" Margin="0,0,0,10"/>
<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">
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="4">
<TextBlock FontSize="14">
<Bold>当前版本:</Bold>
</TextBlock>
<TextBlock FontSize="14" Text="" Name="TextBlockVersion"/>
</ui:SimpleStackPanel>
<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>
<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>
</StackPanel>
</ScrollViewer>
<Grid Background="White" Margin="10,0,10,0" Height="65" VerticalAlignment="Top">
<Grid Margin="10,20,10,0">
<TextBlock Text="设置" FontSize="26" Margin="0,0,0,12"/>
<!--<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>
</Grid>
</Grid>
</Grid>
</Border>
<StackPanel Name="StackPanelMain" Margin="10,0,10,55"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="46">
<StackPanel Name="StackPanelControl">
<Button Name="BtnExit" Content="退出" FontFamily="Microsoft YaHei UI"
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"/>
<TextBlock Text="自动&#x000A;粗细" Visibility="Collapsed" Margin="0,10,0,0"
FontSize="14" HorizontalAlignment="Center"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Viewbox Height="30" Visibility="Collapsed">
<ui:ToggleSwitch Name="ToggleSwitchAutoWeight" Header="" Width="40.5"
FontFamily="Microsoft YaHei UI" FontSize="19"
OnContent="" OffContent="" Toggled="ToggleSwitchAutoWeight_Toggled"/>
</Viewbox>
<StackPanel Name="StackPanelModeFinger" Background="#01000000">
<TextBlock Text="手指&#x000A;模式" Margin="0,10,0,0"
FontSize="14" HorizontalAlignment="Center"
Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Viewbox Height="30">
<ui:ToggleSwitch Name="ToggleSwitchModeFinger" Header="" Width="40.5"
FontFamily="Microsoft YaHei UI" FontSize="19"
OnContent="" OffContent="" Toggled="ToggleSwitchModeFinger_Toggled"/>
</Viewbox>
</StackPanel>
<Button Name="BtnThickness" Content="粗细" Visibility="Collapsed" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnThickness_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<Button Name="BtnErase" Content="橡皮" Visibility="Visible" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnErase_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<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"/>
<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"/>
<StackPanel Name="StackPanelColors" Margin="7,0,7,0">
<Button Name="BtnColorBlack" Content="" FontFamily="Microsoft YaHei UI" Background="Black"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorBlack_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Button Name="BtnColorRed" Content="" FontFamily="Microsoft YaHei UI" Background="Red"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorRed_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Button Name="BtnColorGreen" Content="" FontFamily="Microsoft YaHei UI" Background="#1ED760"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorGreen_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Button Name="BtnColorBlue" Content="" FontFamily="Microsoft YaHei UI" Background="#239AD6"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorBlue_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
<Button Name="BtnColorYellow" Content="" FontFamily="Microsoft YaHei UI" Background="#FFB900"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelColors, Path=ActualWidth}"
Click="BtnColorYellow_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}"/>
</StackPanel>
<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"/>
<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"/>
<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"/>
<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"/>
<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>
<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"/>
</StackPanel>
<Button x:Name="BtnHideControl" Content="⇅" FontFamily="Microsoft YaHei UI"
Margin="0,10,0,0" Width="{Binding ElementName=StackPanelMain, Path=ActualWidth}"
Click="BtnHideControl_Click" Foreground="{Binding ElementName=BtnExit, Path=Foreground}" Background="#7F909090"/>
<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"/>
<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}"/>
</StackPanel>
</Grid>
</Window>