方法一:获得选中的面对象
public Selection GetSelection() { Selection selection = null; m_isRegionSelected = false; foreach (Layer layer in m_mapControl.Map.Layers) { if (layer.Selection.Count != 0 && layer.Dataset.Type == DatasetType.Region) { selection = layer.Selection; m_isRegionSelected = true; } } return selection; }
方法二:
//获得选中的点对象。因为设了Acton.select 所以只能选中一个对象 Selection[] arrSelections = m_mapControl.Map.FindSelection(true); if (arrSelections != null && arrSelections.Length != 0) { //把选择集转化为记录集 recordsetSelected = arrSelections[0].ToRecordset();。