private void InstallSnapPointGraphic(bool install) { IPointsGraphic subject = this.Graphic; CompositeGraphic parent = subject.ParentGraphic as CompositeGraphic; if (parent == null) { return; } if (install && subject.Points.Count > 0) { if (_snapPoint == null) { _snapPoint = new SnapPointGraphic(); } if (!parent.Graphics.Contains(_snapPoint)) { parent.Graphics.Add(_snapPoint); } _snapPoint.CoordinateSystem = subject.CoordinateSystem; _snapPoint.Location = subject.Points[0]; _snapPoint.ResetCoordinateSystem(); parent.Draw(); } else if (_snapPoint != null && parent.Graphics.Contains(_snapPoint)) { parent.Graphics.Remove(_snapPoint); parent.Draw(); } }
static void Main(string[] args) { var compositeGraphic = new CompositeGraphic(); compositeGraphic.Add(new Ellipse()); compositeGraphic.Add(new Rectangle()); var anotherCompositeGraphic = new CompositeGraphic(); anotherCompositeGraphic.Add(new Ellipse()); anotherCompositeGraphic.Add(compositeGraphic); anotherCompositeGraphic.Draw(); }
//画面刷新 private void du_refresh() { du.drawing = compositeGraphic.Draw(); du.InvalidateVisual(); }