我有一個功能在我的課Drawing
調用drawPoly(...)
,這個函數繪製點並連接它們。我想要的是,我怎樣才能將它們隱藏在畫布上?我有我的班級繪圖的8個實例。如果可能,我不想刪除整個Canvas
,只是隱藏繪製的點。WPF:隱藏繪製點
private double t = 0; // x Startpostion für Graph
private double xOld = 0; // x Startpostion für Graph
private double yOld = 100;
System.Windows.Shapes.Path path;
public GeometryGroup pointGroupDrawing = new GeometryGroup();
...
public void drawPoly(double value, Brush colorBrush, int thickness)
{
// is for the x-Axis /time
t++;
// get old value and generate new point
Point pOne = new Point(xOld, yOld);
Point pTwo = new Point(t, value);
// connect old point wit new point
GeometryGroup lineGroup = new GeometryGroup();
LineGeometry connectorGeometry = new LineGeometry();
connectorGeometry.StartPoint = pOne;
connectorGeometry.EndPoint = pTwo;
lineGroup.Children.Add(connectorGeometry);
path = new System.Windows.Shapes.Path();
path.Data = lineGroup;
path.StrokeThickness = thickness;
path.Stroke = path.Fill = colorBrush;
// collect point for redrawing later ?
pointGroupDrawing.Children.Add(connectorGeometry);
// replace old point with new
xOld = t;
yOld = value;
coordinateSystem.Children.Add(path);
}
我可以用這個pointGroupDrawing.Children.Add(connectorGeometry);
隱藏舊的點嗎?
爲什麼要隱藏點? – ThaMe90