本文介绍了WPF:如何删除画布中的某些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好,我正在尝试制作绘图板支持添加形状和图像。对于我使用此代码我不认为有办法擦除它但只是尝试: Hello, I''m trying to make a drawing board tha support adding shapes and images. for I use this code and I don''t think that there is a way to erase it but just trying: Dim lin As New Line lin.Stroke = New SolidColorBrush(Color.FromArgb(100, 255, 0, 0)) lin.StrokeThickness = 5'lastpnt is the LastPoint added to continue the drawing and it will be null on mouse_up Event If Not lastpnt = Nothing Then lin.X1 = lastpnt.X lin.Y1 = lastpnt.Y lin.X2 = position.X lin.Y2 = position.Y lastpnt.X = position.X lastpnt.Y = position.Y Else lin.X1 = position.X lin.Y1 = position.Y lin.X2 = position.X lin.Y2 = position.Y lastpnt.X = position.X lastpnt.Y = position.Y End If Canvas1.Children.Add(lin) 我可以使橡皮擦与背景颜色相同,但如果背面颜色是透明或是图像 ???? 我现在将阅读''$ code> InkCanvas ''源代码,试图找到另一种绘制和擦除方式。 :我没有使用inkcanvas du e不支持在绘图上方添加图像然后在图像上绘图(我不知道如何解释,但它像墨水和图像zOrder) I can make the eraser the same as background color but what if the back color was transparent or was an image ????I will now read the ''InkCanvas'' source code trying to find another way to draw and erase. : I didn''t use inkcanvas due to no support adding images above the ink drawing and then drawing on image (I don''t know how to explain but its like ink and Images zOrder)推荐答案 这篇关于WPF:如何删除画布中的某些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-24 13:50