在下面的代码中,对 Zoom(0.1f);
和 Zoom(-0.1f);
的两次调用有效,但我无法触发这两个 UndoRedoManager.Undo();
和 UndoRedoManager.Redo();
调用 CTRL+Z 和 CTRL+Y。我做错了什么?
public void WorkspaceKeyDown(KeyEventArgs e)
{
if (e.Control == true)
isCtrlPres = true;
if (e.Shift == true)
isShiftPres = true;
if (e.Control == true && e.KeyCode == Keys.Z)
{
UndoRedoManager.Undo();
}
else if (e.Control == true && e.KeyCode == Keys.Y)
{
UndoRedoManager.Redo();
}
else if (e.Control == true && e.KeyCode == Keys.Oemplus)
{
Zoom(0.1f);
}
else if (e.Control == true && e.KeyCode == Keys.OemMinus)
{
Zoom(-0.1f);
}
最佳答案
.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
关于c# - 为什么 KeyDown CTRL+KEY 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6101549/