/// <summary> /// 画图完成事件 /// </summary> /// <param name="geometry">画上去的图形</param> private void DrawingLayer_DrawCompleted(Geometry geometry) { this.drawingLayer.Visible = false; this.drawingLayer.DrawingType = DrawingCanavsGeometries.None; if (this.selectedLayer == null) { this.selectedLayer = this.layers.FirstOrDefault(); } this.selectedLayer.AddGeometry(geometry); }
/// <summary> /// 创建一个空的图层并返回 /// </summary> /// <returns></returns> private GeometryLayer AddGeometryLayer() { GeometryLayer layer = new GeometryLayer() { Options = this.Options, }; this.Controls.Add(layer); this.layers.Add(layer); layer.Dock = DockStyle.Fill; return(layer); }
private void InitializeUserControl() { this.Options = new DrawingOptionsGDI() { PolygonBackgroundColor = Color.Orange, PolygonBroderColor = Color.Green, PolygonBorderWidth = 3 }; // 所有图层 this.layers = new ObservableCollection <GeometryLayer>(); // 初始化图层 this.selectedLayer = this.AddGeometryLayer(); // 用来画图的Panel this.InitializeDrawingLayer(); }