private void btn_SearchBySpace_Click(object sender, EventArgs e) { FrmSelectLayer pLayerFrm = new FrmSelectLayer(); pLayerFrm.m_axMapControl = axMapControl1; if (pLayerFrm.ShowDialog() == DialogResult.OK) { IArray aFeatures = GeoBaseLib.GetSelectedFeatures(axMapControl1); if (aFeatures.Count == 0) { MessageBox.Show("没有选中目标!"); return; } IFeature pSelFeature = aFeatures.get_Element(0) as IFeature; try { IArray pFeatures = GeoBaseLib.SelectFeatureByGeometry((IFeatureLayer)pLayerFrm.m_pLayer, pSelFeature.ShapeCopy); for (int i = 0; i < pFeatures.Count; i++) { IFeature pFeature = pFeatures.get_Element(i) as IFeature; IRgbColor pColor = new RgbColorClass(); pColor.RGB = 255; GeoBaseLib.DrawElement(axMapControl1, pFeature.ShapeCopy, pColor); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void btn_Chart_Click(object sender, EventArgs e) { FrmSelectLayer pLayerFrm = new FrmSelectLayer(); pLayerFrm.m_axMapControl = axMapControl1; if (pLayerFrm.ShowDialog() == DialogResult.OK) { ESRI.ArcGIS.SystemUI.ICommand cmd; cmd = new GISBase.Visualization.BarChart(); cmd.OnCreate(axMapControl1.GetOcx()); ((GISBase.Visualization.BarChart)cmd).pLayer = pLayerFrm.m_pLayer as IFeatureLayer; if (cmd.Enabled) { cmd.OnClick(); this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); } } }