IFeatureLayer pFLayer = mapMain.get_Layer(0) as IFeatureLayer;
IFeatureClass pFC = pFLayer.FeatureClass;
//类型不对停止编辑
if (pFC.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { return; }
//建立编辑空间
IDataset pDataset = pFC as IDataset;
IWorkspace pWorkspace = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWorkspace as IWorkspaceEdit;
//开始编辑
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
//创建点
ESRI.ArcGIS.Geometry.IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
point.X = e.mapX;
point.Y = e.mapY;
IFeature pFeature = pFC.CreateFeature();
pFeature.Shape = point;//设置新建的元素为点元素
//对元素设置属性值: pFeature.set_Value(pFeature.Fields.FindField("Name"), name);
pFeature.Store();
//停止编辑
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapMain.ActiveView.Refresh();//更新视窗