improve:快捷键
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
ShowInTaskbar="False"
|
||||
Title="InkCanvasforClass"
|
||||
Topmost="True"
|
||||
KeyDown="Window_KeyDown"
|
||||
Closing="Window_Closing"
|
||||
Closed="Window_Closed"
|
||||
PreviewKeyDown="Main_Grid_PreviewKeyDown"
|
||||
@@ -43,25 +42,6 @@
|
||||
<c:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<c:IntNumberToString x:Key="IntNumberToString" />
|
||||
<c:IntNumberToString2 x:Key="IntNumberToString2" />
|
||||
<RoutedUICommand x:Key="KeyExit" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Command_Undo" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Command_Redo" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Command_Clear" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Capture" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Hide" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToDrawTool" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToQuitDrawTool" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToSelect" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToEraser" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToBoard" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToPen1" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToPen2" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToPen3" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToPen4" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToPen5" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_DrawLine" Text=" " />
|
||||
<RoutedUICommand x:Key="HotKey_Paste" Text=" " />
|
||||
<RoutedUICommand x:Key="NothingWillHappened" Text=" " />
|
||||
|
||||
<!-- Navigation Button Style -->
|
||||
<Style x:Key="NavButton" TargetType="Button">
|
||||
@@ -130,56 +110,6 @@
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<!--输入命令绑定-->
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Gesture="Escape" Command="{StaticResource KeyExit}" />
|
||||
<KeyBinding Modifiers="Control" Key="Z" Command="{StaticResource HotKey_Command_Undo}" />
|
||||
<KeyBinding Modifiers="Control" Key="Y" Command="{StaticResource HotKey_Command_Redo}" />
|
||||
<KeyBinding Modifiers="Control" Key="E" Command="{StaticResource HotKey_Command_Clear}" />
|
||||
<KeyBinding Modifiers="Alt" Key="C" Command="{StaticResource HotKey_Capture}" />
|
||||
<KeyBinding Modifiers="Alt" Key="V" Command="{StaticResource HotKey_Hide}" />
|
||||
<KeyBinding Modifiers="Alt" Key="S" Command="{StaticResource HotKey_ChangeToSelect}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D" Command="{StaticResource HotKey_ChangeToDrawTool}" />
|
||||
<KeyBinding Modifiers="Alt" Key="Q" Command="{StaticResource HotKey_ChangeToQuitDrawTool}" />
|
||||
<KeyBinding Modifiers="Alt" Key="E" Command="{StaticResource HotKey_ChangeToEraser}" />
|
||||
<KeyBinding Modifiers="Alt" Key="B" Command="{StaticResource HotKey_ChangeToBoard}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D1" Command="{StaticResource HotKey_ChangeToPen1}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D2" Command="{StaticResource HotKey_ChangeToPen2}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D3" Command="{StaticResource HotKey_ChangeToPen3}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D4" Command="{StaticResource HotKey_ChangeToPen4}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D5" Command="{StaticResource HotKey_ChangeToPen5}" />
|
||||
<KeyBinding Modifiers="Alt" Key="L" Command="{StaticResource HotKey_DrawLine}" />
|
||||
<KeyBinding Modifiers="Control" Key="V" Command="{StaticResource HotKey_Paste}" />
|
||||
<KeyBinding Modifiers="Alt" Key="F4" Command="{StaticResource NothingWillHappened}" />
|
||||
</Window.InputBindings>
|
||||
<!--命令执行方法绑定-->
|
||||
<Window.CommandBindings>
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource KeyExit}" Executed="KeyExit" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Command_Undo}"
|
||||
Executed="HotKey_Undo" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Command_Redo}"
|
||||
Executed="HotKey_Redo" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Command_Clear}"
|
||||
Executed="HotKey_Clear" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_ChangeToDrawTool}"
|
||||
Executed="KeyChangeToDrawTool" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_ChangeToQuitDrawTool}"
|
||||
Executed="KeyChangeToQuitDrawTool" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_ChangeToSelect}"
|
||||
Executed="KeyChangeToSelect" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_ChangeToEraser}"
|
||||
Executed="KeyChangeToEraser" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_ChangeToBoard}"
|
||||
Executed="KeyChangeToBoard" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Capture}"
|
||||
Executed="KeyCapture" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Hide}"
|
||||
Executed="KeyHide" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_DrawLine}"
|
||||
Executed="KeyDrawLine" />
|
||||
<CommandBinding CanExecute="CommandBinding_CanExecute" Command="{StaticResource HotKey_Paste}"
|
||||
Executed="HandleGlobalPaste" />
|
||||
</Window.CommandBindings>
|
||||
|
||||
<Grid x:Name="Main_Grid">
|
||||
|
||||
|
||||
@@ -44,15 +44,8 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape) KeyExit(null, null);
|
||||
}
|
||||
|
||||
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
e.CanExecute = true;
|
||||
}
|
||||
// 保留PPT翻页快捷键处理
|
||||
// 以下方法保留供全局快捷键调用
|
||||
|
||||
private void HotKey_Undo(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user