主要原因是因为DrawingCanvas工具绘制刷新图形后,将鼠标焦点设置到DrawingCanvas工具上,需要将工具的焦点释放。
释放代码为:
drawingCanvas.DrawingCanvasReleaseMouseCapture();
public void DrawingCanvasReleaseMouseCapture()
{
this.ReleaseMouseCapture();
}
//失去焦点
public void ReleaseMouseCapture()
{
if (Mouse.Captured == this)
{
Mouse.Capture(null);
}
}
//获取焦点
public bool CaptureMouse()
{
return Mouse.Capture(this);
}