private void combo_layer_SelectedIndexChanged(object sender, EventArgs e) { data_operate dop = new data_operate(); feaLyr = (dop.GetLayerByName(map, combo_layer.SelectedItem.ToString())) as IFeatureLayer; IFeatureClass feaCls = null; if (feaLyr != null) { feaCls = feaLyr.FeatureClass; for (int i = 0; i < feaCls.Fields.FieldCount; i++) { string strFieldName = feaCls.Fields.get_Field(i).Name; listBox_attri.Items.Add(strFieldName); } } }
private void btn_ok_Click(object sender, EventArgs e) { if (combo_layer.SelectedItem == null) { MessageBox.Show("没有图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (combo_unit.SelectedItem == null || text_dis.Text == null || text_path == null) { MessageBox.Show("请完善距离、单位、路径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } data_operate dop = new data_operate(); feaLyr = dop.GetLayerByName(map, combo_layer.SelectedItem.ToString()) as IFeatureLayer; distance = System.Convert.ToDouble(text_dis.Text); unit = combo_unit.SelectedItem.ToString(); MapAnalysis.BufferAnalysis(feaLyr, path, distance, unit); }