[feat] 初步实现快捷键
This commit is contained in:
parent
5b64b1b834
commit
e30ee836c4
@ -30,11 +30,31 @@
|
||||
<c:VisibilityConverter x:Key="VisibilityConverter"/>
|
||||
<RoutedUICommand x:Key="KeyExit" Text=" "/>
|
||||
<RoutedUICommand x:Key="back_HotKey_Command" Text=" "/>
|
||||
<RoutedUICommand x:Key="HotKey_Capture" Text=" "/>
|
||||
<RoutedUICommand x:Key="HotKey_Hide" Text=" "/>
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToDrawTool" Text=" "/>
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToSelect" Text=" "/>
|
||||
<RoutedUICommand x:Key="HotKey_ChangeToEraser" 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=" "/>
|
||||
</Window.Resources>
|
||||
<!--输入命令绑定-->
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Gesture="Shift+Esc" Command="{StaticResource KeyExit}"/>
|
||||
<KeyBinding Modifiers="Ctrl" Key="Z" Command="{StaticResource back_HotKey_Command}"/>
|
||||
<KeyBinding Modifiers="Alt" Key="Z" Command="{StaticResource back_HotKey_Command}"/>
|
||||
<KeyBinding Modifiers="Alt" Key="S" Command="{StaticResource HotKey_ChangeToSelect}" />
|
||||
<KeyBinding Modifiers="Alt" Key="D" Command="{StaticResource HotKey_ChangeToDrawTool}" />
|
||||
<KeyBinding Modifiers="Alt" Key="E" Command="{StaticResource HotKey_ChangeToEraser}" />
|
||||
<KeyBinding Modifiers="Alt" Key="C" Command="{StaticResource HotKey_Capture}" />
|
||||
<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="V" Command="{StaticResource HotKey_Hide}" />
|
||||
</Window.InputBindings>
|
||||
<!--命令执行方法绑定-->
|
||||
<Window.CommandBindings>
|
||||
@ -44,6 +64,21 @@
|
||||
<CommandBinding Command="{StaticResource KeyExit}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="KeyExit"/>
|
||||
<CommandBinding Command="{StaticResource HotKey_ChangeToDrawTool}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="ChangeToDrawTool"/>
|
||||
<CommandBinding Command="{StaticResource HotKey_ChangeToSelect}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="ChangeToSelect"/>
|
||||
<CommandBinding Command="{StaticResource HotKey_ChangeToEraser}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="ChangeToEraser"/>
|
||||
<CommandBinding Command="{StaticResource HotKey_Capture}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="Capture"/>
|
||||
<CommandBinding Command="{StaticResource HotKey_Hide}"
|
||||
CanExecute="CommandBinding_CanExecute"
|
||||
Executed="Hide"/>
|
||||
</Window.CommandBindings>
|
||||
<Grid x:Name="Main_Grid" Background="#01FFFFFF">
|
||||
<Grid Name="GridBackgroundCoverHolder">
|
||||
|
@ -267,6 +267,44 @@ namespace Ink_Canvas
|
||||
BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null);
|
||||
}
|
||||
|
||||
private void ChangeToDrawTool(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (inkCanvas.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
BtnHideInkCanvas_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeToSelect(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (inkCanvas.Visibility == Visibility.Visible)
|
||||
{
|
||||
BtnHideInkCanvas_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeToEraser(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
if (ImageEraserMask.Visibility == Visibility.Visible)
|
||||
{
|
||||
BtnColorRed_Click(sender, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
BtnErase_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void Capture(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
BtnScreenshot_Click(sender,e);
|
||||
}
|
||||
|
||||
private void Hide(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
SymbolIconEmoji_MouseUp(sender, null);
|
||||
}
|
||||
|
||||
#endregion Hotkeys
|
||||
|
||||
#region Definations and Loading
|
||||
@ -6170,7 +6208,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
isDragDropInEffect = false;
|
||||
|
||||
if (downPos.X == e.GetPosition(null).X && downPos.Y == e.GetPosition(null).Y)
|
||||
if (e is null || (downPos.X == e.GetPosition(null).X && downPos.Y == e.GetPosition(null).Y))
|
||||
{
|
||||
if (BorderFloatingBarMainControls.Visibility == Visibility.Visible)
|
||||
{
|
||||
@ -6299,6 +6337,7 @@ namespace Ink_Canvas
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#region Test for pen
|
||||
|
Loading…
Reference in New Issue
Block a user