本文整理汇总了C#中System.Windows.Input.KeyEventArgs.ToTEKeyArgs方法的典型用法代码示例。如果您正苦于以下问题:C# KeyEventArgs.ToTEKeyArgs方法的具体用法?C# KeyEventArgs.ToTEKeyArgs怎么用?C# KeyEventArgs.ToTEKeyArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Input.KeyEventArgs
的用法示例。
在下文中一共展示了KeyEventArgs.ToTEKeyArgs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: canvas1_KeyUp
private void canvas1_KeyUp(object sender, KeyEventArgs e)
{
// route event to current tool
TEKeyArgs ee = e.ToTEKeyArgs();
TheModel.CurrentTool.KeyUp(ee);
e.Handled = ee.Handled;
// turn on raster on Alt released
Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
e.Handled = true;
}
示例2: canvas1_KeyDown
private void canvas1_KeyDown(object sender, KeyEventArgs e)
{
// route event to current tool
TEKeyArgs ee = e.ToTEKeyArgs();
TheModel.CurrentTool.KeyDown(ee);
e.Handled = ee.Handled;
// turn off raster on Alt
Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
e.Handled = true;
if (!e.Handled)
{
// escape cancels current operation
if (e.Key == Key.Escape)
TheModel.ActivateDefaultTool();
}
}