WPF和WinForm判断组合键

WPF:判断Control+Z的组合键

 if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.Z)

{

//处理逻辑

 WinForm:判断Control+Z的组合键
if (e.Modifiers.CompareTo(Keys.Control) == 0 && e.KeyCode == Keys.Z)
{
     //处理逻辑
}

你可能感兴趣的:(WPF和WinForm判断组合键)