问题描述
private void inkCanvas1_OnTouchMove(object sender,TouchEventArgs touchEventArgs)
{
StylusShape EraseShape = (StylusShape)new RectangleStylusShape(20,20,0);
List<Point> enumrator = new List<Point>();
TouchPoint touchPoint = touchEventArgs.GetTouchPoint(this);
enumrator.Add(new Point(touchPoint.Position.X,touchPoint.Position.Y));
inkCanvas1.strokes.Erase(enumrator,EraseShape);//**reverse operation of this statement**
}
,我想在执行撤消操作后将擦除的笔划向后撤消。
我已经尝试了以下事件代码。但是当我擦除多个笔划时,此逻辑效果不佳。
System.Windows.Ink.strokeCollection addedstrokes;
System.Windows.Ink.strokeCollection removedstrokes;
bool undoRedoInProcess = false;
private void strokes_strokesChanged(object sender,System.Windows.Ink.strokeCollectionChangedEventArgs e)
{
if (undoRedoInProcess)
{
addedstrokes = e.Added;
removedstrokes = e.Removed;
}
}
private void Undo()
{
undoRedoInProcess = true;
inkCanvas1.strokes.Remove(removedstrokes);
inkCanvas1.strokes.Add(addedstrokes);
undoRedoInProcess = false;
}
private void Redo()
{
undoRedoInProcess = true;
inkCanvas1.strokes.Add(addedstrokes);
inkCanvas1.strokes.Remove(removedstrokes);
undoRedoInProcess = false;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)