Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Esc以下代码,按下时不会触发。有人可以给我见解吗?我喜欢改变光标(比如说从绘图模式变成指针模式)
public override void OnKeyDown(MyCanvas dc, KeyEventArgs e) { if (e.Key == Key.Escape) { _line = null; e.Handled = true; } }
谢谢。
@amit 的解决方案:
public override void OnKeyDown(MyCanvas dc, KeyEventArgs e) { if (e.Key == Key.Escape) { _line = null; dc.CurrentTool = ToolType.Pointer; dc.Cursor = Cursors.Arrow; dc.ReleaseMouseCapture(); } }