private void tslCurrentLayer_Click(object sender, EventArgs e) { LayerDialog ld = new LayerDialog(drawArea.TheLayers); ld.ShowDialog(); // First add any new layers for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerNew) { Layer layer = new Layer(); layer.LayerName = ld.layerList[i].LayerName; layer.Graphics = new GraphicsList(); drawArea.TheLayers.Add(layer); } } drawArea.TheLayers.InactivateAllLayers(); for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerActive) { drawArea.TheLayers.SetActiveLayer(i); } if (ld.layerList[i].LayerVisible) { drawArea.TheLayers.MakeLayerVisible(i); } else { drawArea.TheLayers.MakeLayerInvisible(i); } drawArea.TheLayers[i].LayerName = ld.layerList[i].LayerName; } // Lastly, remove any deleted layers for (int i = 0; i < ld.layerList.Count; i++) { if (ld.layerList[i].LayerDeleted) { drawArea.TheLayers.RemoveLayer(i); } } drawArea.Invalidate(); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnMouseDoubleClick(MouseEventArgs e) { _wasDoubleClick = true; Point loc = new Point(e.X + ControlRectangle.X, e.Location.Y + ControlRectangle.Top); foreach (LegendBox lb in _legendBoxes) { if (!lb.Bounds.Contains(loc) || lb.CheckBox.Contains(loc)) { continue; } ILineCategory lc = lb.Item as ILineCategory; if (lc != null) { DetailedLineSymbolDialog lsDialog = new DetailedLineSymbolDialog(lc.Symbolizer); lsDialog.ShowDialog(); ILineSymbolizer sel = lc.Symbolizer.Copy(); sel.SetFillColor(Color.Cyan); lc.SelectionSymbolizer = sel; } IPointCategory pc = lb.Item as IPointCategory; if (pc != null) { DetailedPointSymbolDialog dlg = new DetailedPointSymbolDialog(pc.Symbolizer); dlg.ShowDialog(); IPointSymbolizer ps = pc.Symbolizer.Copy(); ps.SetFillColor(Color.Cyan); pc.SelectionSymbolizer = ps; } IPolygonCategory polyCat = lb.Item as IPolygonCategory; if (polyCat != null) { DetailedPolygonSymbolDialog dlg = new DetailedPolygonSymbolDialog(polyCat.Symbolizer); dlg.ShowDialog(); IPolygonSymbolizer ps = polyCat.Symbolizer.Copy(); ps.SetFillColor(Color.Cyan); ps.OutlineSymbolizer.SetFillColor(Color.DarkCyan); polyCat.SelectionSymbolizer = ps; } IFeatureLayer fl = lb.Item as IFeatureLayer; if (fl != null) { LayerDialog layDialog = new LayerDialog(fl, new FeatureCategoryControl()); layDialog.ShowDialog(); } IRasterLayer rl = lb.Item as IRasterLayer; if (rl != null) { LayerDialog dlg = new LayerDialog(rl, new RasterCategoryControl()); dlg.ShowDialog(); } IColorCategory cb = lb.Item as IColorCategory; if (cb != null) { _tabColorDialog = new TabColorDialog(); _tabColorDialog.ChangesApplied += TabColorDialogChangesApplied; _tabColorDialog.StartColor = cb.LowColor; _tabColorDialog.EndColor = cb.HighColor; _editCategory = cb; _tabColorDialog.ShowDialog(this); } } base.OnMouseDoubleClick(e); }