1 MapXLib.Feature obj;
2 MapXLib.Features selectedFtrs;
3 MapXLib.Layer lyr;
4
5 lyr = axMap.Layers._Item("LayerName");
6
7 if (lyr.Selection.Count > 0)
8 {
9 selectedFtrs = (MapXLib.Features)lyr.Selection;
10 if (MessageBox.Show("确定要删除所选择的项吗?", "确认", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
11 {
12 for (int i = 1; i <= lyr.Selection.Count; i++)
13 {
14 obj = selectedFtrs[i];
15 lyr.DeleteFeature(obj); //删除图元
16 }
17 lyr.Pack(MapXLib.LayerPackConstant.miPackAll); //紧缩表
18 }
19 }
2 MapXLib.Features selectedFtrs;
3 MapXLib.Layer lyr;
4
5 lyr = axMap.Layers._Item("LayerName");
6
7 if (lyr.Selection.Count > 0)
8 {
9 selectedFtrs = (MapXLib.Features)lyr.Selection;
10 if (MessageBox.Show("确定要删除所选择的项吗?", "确认", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
11 {
12 for (int i = 1; i <= lyr.Selection.Count; i++)
13 {
14 obj = selectedFtrs[i];
15 lyr.DeleteFeature(obj); //删除图元
16 }
17 lyr.Pack(MapXLib.LayerPackConstant.miPackAll); //紧缩表
18 }
19 }