0

Esc以下代码,按下时不会触发。有人可以给我见解吗?我喜欢改变光标(比如说从绘图模式变成指针模式)

    public override void OnKeyDown(MyCanvas dc, KeyEventArgs e)
    {
        if (e.Key == Key.Escape)
        {
            _line = null;
            e.Handled = true;
        }
    }

谢谢。

4

1 回答 1

2

@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();

    }
}
于 2012-08-23T00:29:24.963 回答