Files
community/Ink Canvas/MainWindow_cs/MW_Hotkeys.cs
T

121 lines
3.9 KiB
C#
Raw Normal View History

2025-05-25 09:29:48 +08:00
using System.Windows;
using System.Windows.Input;
2025-08-03 16:46:33 +08:00
namespace Ink_Canvas
{
public partial class MainWindow : Window
{
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
{
2025-11-15 18:04:22 +08:00
if (BtnPPTSlideShowEnd.Visibility != Visibility.Visible || currentMode != 0) return;
2025-05-25 09:29:48 +08:00
if (e.Delta >= 120)
2025-08-24 11:08:13 +08:00
{
2025-11-15 18:04:22 +08:00
BtnPPTSlidesUp_Click(null, null);
2025-08-24 11:08:13 +08:00
}
else if (e.Delta <= -120)
{
2025-11-15 18:04:22 +08:00
BtnPPTSlidesDown_Click(null, null);
2025-08-24 11:08:13 +08:00
}
2025-05-25 09:29:48 +08:00
}
2025-08-03 16:46:33 +08:00
private void Main_Grid_PreviewKeyDown(object sender, KeyEventArgs e)
{
2025-11-15 18:04:22 +08:00
if (BtnPPTSlideShowEnd.Visibility != Visibility.Visible || currentMode != 0) return;
2025-05-25 09:29:48 +08:00
2025-11-15 18:04:22 +08:00
if (e.Key == Key.Down || e.Key == Key.PageDown || e.Key == Key.Right || e.Key == Key.N || e.Key == Key.Space)
2025-08-24 11:08:13 +08:00
{
2025-11-15 18:04:22 +08:00
BtnPPTSlidesDown_Click(null, null);
2025-08-24 11:08:13 +08:00
}
2025-11-15 18:04:22 +08:00
if (e.Key == Key.Up || e.Key == Key.PageUp || e.Key == Key.Left || e.Key == Key.P)
2025-08-24 11:08:13 +08:00
{
2025-11-15 18:04:22 +08:00
BtnPPTSlidesUp_Click(null, null);
2025-08-24 11:08:13 +08:00
}
2025-05-25 09:29:48 +08:00
}
2025-08-03 16:46:33 +08:00
private void HotKey_Undo(object sender, ExecutedRoutedEventArgs e)
{
try
{
2025-05-25 09:29:48 +08:00
SymbolIconUndo_MouseUp(lastBorderMouseDownObject, null);
}
catch { }
}
2025-08-03 16:46:33 +08:00
private void HotKey_Redo(object sender, ExecutedRoutedEventArgs e)
{
try
{
2025-05-25 09:29:48 +08:00
SymbolIconRedo_MouseUp(lastBorderMouseDownObject, null);
}
catch { }
}
2025-08-03 16:46:33 +08:00
private void HotKey_Clear(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
SymbolIconDelete_MouseUp(lastBorderMouseDownObject, null);
}
2025-08-23 21:39:00 +08:00
internal void KeyExit(object sender, ExecutedRoutedEventArgs e)
2025-08-03 16:46:33 +08:00
{
2025-05-25 09:29:48 +08:00
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) BtnPPTSlideShowEnd_Click(BtnPPTSlideShowEnd, null);
}
2025-08-03 16:46:33 +08:00
private void KeyChangeToDrawTool(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
PenIcon_Click(lastBorderMouseDownObject, null);
}
2025-08-30 23:53:26 +08:00
internal void KeyChangeToQuitDrawTool(object sender, ExecutedRoutedEventArgs e)
2025-08-03 16:46:33 +08:00
{
2025-08-30 23:28:28 +08:00
if (currentMode != 0)
{
// 在白板模式下,alt+q 退出白板模式
ImageBlackboard_MouseUp(lastBorderMouseDownObject, null);
}
else
{
// 在非白板模式下,alt+q 切换到鼠标模式
CursorIcon_Click(lastBorderMouseDownObject, null);
}
2025-05-25 09:29:48 +08:00
}
2025-08-03 16:46:33 +08:00
private void KeyChangeToSelect(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
if (StackPanelCanvasControls.Visibility == Visibility.Visible)
SymbolIconSelect_MouseUp(lastBorderMouseDownObject, null);
}
2025-08-03 16:46:33 +08:00
private void KeyChangeToEraser(object sender, ExecutedRoutedEventArgs e)
{
if (StackPanelCanvasControls.Visibility == Visibility.Visible)
{
2025-05-25 09:29:48 +08:00
if (Eraser_Icon.Background != null)
EraserIconByStrokes_Click(lastBorderMouseDownObject, null);
else
EraserIcon_Click(lastBorderMouseDownObject, null);
}
}
2025-08-03 16:46:33 +08:00
private void KeyChangeToBoard(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
ImageBlackboard_MouseUp(lastBorderMouseDownObject, null);
}
2025-08-03 16:46:33 +08:00
private void KeyCapture(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
SaveScreenShotToDesktop();
}
2025-08-03 16:46:33 +08:00
private void KeyDrawLine(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
if (StackPanelCanvasControls.Visibility == Visibility.Visible) BtnDrawLine_Click(lastMouseDownSender, null);
}
2025-08-03 16:46:33 +08:00
private void KeyHide(object sender, ExecutedRoutedEventArgs e)
{
2025-05-25 09:29:48 +08:00
SymbolIconEmoji_MouseUp(null, null);
}
}
}