C# wpf中inkcanvas上的橡皮擦 private void inkcanvas\u StrokeErased(对象发送方,路由目标) { var erasedstrokes=(发送方作为InkCanvas)。笔划; After橡皮擦行程采集=橡皮擦行程; foreach(aftererasedstrokecollection中的var项) { 删除笔画。添加(项目); } } 私有void inkcanvas_StrokeRasing(对象发送方InkCanvasStrokeRasingEventArgs e) { var beforeerased=(发送方作为InkCanvas)。笔划; beforeerasedstrokecollection=删除前; foreach(beforeerasedstrokecollection中的var项) { 未移动行程。添加(项目); } } 私有void btundo\u单击(对象发送者,路由目标e) { 如果(DrawingTool==“橡皮擦”| | DrawingTool==“删除”) { int length=removedstrokes.Count; for(int i=0;i
我想在C# wpf中inkcanvas上的橡皮擦 private void inkcanvas\u StrokeErased(对象发送方,路由目标) { var erasedstrokes=(发送方作为InkCanvas)。笔划; After橡皮擦行程采集=橡皮擦行程; foreach(aftererasedstrokecollection中的var项) { 删除笔画。添加(项目); } } 私有void inkcanvas_StrokeRasing(对象发送方InkCanvasStrokeRasingEventArgs e) { var beforeerased=(发送方作为InkCanvas)。笔划; beforeerasedstrokecollection=删除前; foreach(beforeerasedstrokecollection中的var项) { 未移动行程。添加(项目); } } 私有void btundo\u单击(对象发送者,路由目标e) { 如果(DrawingTool==“橡皮擦”| | DrawingTool==“删除”) { int length=removedstrokes.Count; for(int i=0;i,c#,wpf,C#,Wpf,我想在WPF中单击撤消时再次绘制已擦除的笔划。通过上面的代码,我对单个笔划执行此操作,但我想对多个笔划执行相同的操作。 请提出任何意见 如何通过inkcanvas的erasedbypoint方法仅获得擦除点?多少是多个笔划?例如,我在inkcanvas上画了一条线,然后它只显示一个笔划,当我从中间擦除这条线时,它分成两部分并显示两个笔划。现在我得到了线的剩余部分在擦除后的阻塞点。你们找到解决方法了吗?我也有类似的情况@用户3183760 private void inkcanvas_Stroke
WPF
中单击撤消时再次绘制已擦除的笔划。通过上面的代码,我对单个笔划执行此操作,但我想对多个笔划执行相同的操作。
请提出任何意见
如何通过inkcanvas的erasedbypoint方法仅获得擦除点?多少是多个笔划?例如,我在inkcanvas上画了一条线,然后它只显示一个笔划,当我从中间擦除这条线时,它分成两部分并显示两个笔划。现在我得到了线的剩余部分在擦除后的阻塞点。你们找到解决方法了吗?我也有类似的情况@用户3183760
private void inkcanvas_StrokeErased(object sender, RoutedEventArgs e)
{
var erasedstrokes = (sender as InkCanvas).Strokes;
aftererasedstrokecollection = erasedstrokes;
foreach (var item in aftererasedstrokecollection)
{
removedstrokes.Add(item);
}
}
private void inkcanvas_StrokeErasing(object sender InkCanvasStrokeErasingEventArgs e)
{
var beforeerased = (sender as InkCanvas).Strokes;
beforeerasedstrokecollection = beforeerased;
foreach (var item in beforeerasedstrokecollection)
{
unremovedstrokes.Add(item);
}
}
private void btnUndo_Click(object sender, RoutedEventArgs e)
{
if (DrawingTool == "Eraser" || DrawingTool == "Delete")
{
int length = removedstrokes.Count;
for (int i = 0; i < length; i++)
{
estroke = removedstrokes[i];
inkcanvas.Strokes.Remove(estroke);
}
for (int i = 0; i < unremovedstrokes.Count; i++)
{
estroke = unremovedstrokes[i];
inkcanvas.Strokes.Add(estroke);
}
}
else
{
if (inkcanvas.Strokes.Count > 0)
{
int i = inkcanvas.Strokes.Count;
inkcanvas.Strokes.RemoveAt(i - 1);
}
}
removedstrokes.Clear();
DrawingTool = "UnDo";
HighlightSelectedButton(sender);
IsDrawing = false;
inkcanvas.EditingMode = InkCanvasEditingMode.None;
}