// Change Area style of all regions in the region layer private void button1_Click(object sender, System.EventArgs e) { //Get the layer we want FeatureLayer _lyr = this.mapControl1.Map.Layers["world"] as FeatureLayer; //Create and show the style dialog if (_areaStyleDlg == null) { _areaStyleDlg = new AreaStyleDlg(); } // After getting style from dialog, create and apply the featureoverridestylemodifier object to layer if (_areaStyleDlg.ShowDialog() == DialogResult.OK) { FeatureOverrideStyleModifier fsm = new FeatureOverrideStyleModifier(null, new MapInfo.Styles.CompositeStyle(_areaStyleDlg.AreaStyle)); _lyr.Modifiers.Append(fsm); this.mapControl1.Map.Zoom = new MapInfo.Geometry.Distance(25000, MapInfo.Geometry.DistanceUnit.Mile); } }
private void buttonAreaStyleDialog_Click(object sender, System.EventArgs e) { if (_areaStyleDlg == null) { _areaStyleDlg = new AreaStyleDlg(); } _areaStyleDlg.AreaStyle = new AreaStyle(_lineStyle, _fillStyle); if (_areaStyleDlg.ShowDialog() == DialogResult.OK) { if (_areaStyleDlg.AreaStyle.Border is SimpleLineStyle) { _lineStyle = (SimpleLineStyle)_areaStyleDlg.AreaStyle.Border; } else { throw new System.NotImplementedException("New style type not handled."); } if (_areaStyleDlg.AreaStyle.Interior is SimpleInterior) { _fillStyle = (SimpleInterior)_areaStyleDlg.AreaStyle.Interior; } else { throw new System.NotImplementedException("New style type not handled."); } SetFillSample(); } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if (this._lineStyleDlg != null) { this._lineStyleDlg.Dispose(); this._lineStyleDlg = null; } if (this._areaStyleDlg != null) { this._areaStyleDlg.Dispose(); this._areaStyleDlg = null; } if (this._textStyleDlg != null) { this._textStyleDlg.Dispose(); this._textStyleDlg = null; } if (this._symbolStyleDlg != null) { this._symbolStyleDlg.Dispose(); this._symbolStyleDlg = null; } if( disposing ) { if (components != null) { components.Dispose(); } } Session.Dispose(); base.Dispose( disposing ); }