Hi Mengbo,
Here is the code,
//======================== Add point feature ==================================================================
PointShape currentPoint = new PointShape(-100, 34);// e.WorldLocation;
ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer("your point shape file", ShapeFileReadWriteMode.ReadWrite);
pointLayer.Open();
Collection<FeatureSourceColumn> columns = pointLayer.FeatureSource.GetColumns();
pointLayer.FeatureSource.BeginTransaction();
Feature newFeature = new Feature(currentPoint);
newFeature.ColumnValues.Add("LabelColumn", "New place");
pointLayer.FeatureSource.AddFeature(newFeature);
pointLayer.FeatureSource.CommitTransaction();
pointLayer.FeatureSource.Close();
winformsMap1.Refresh();
//======================== Add polygon feature ==================================================================
PointShape point1 = new PointShape(-100, 34);
PointShape point2 = new PointShape(-101, 35);
double minx = Math.Min(point1.X,point1.X);
double miny = Math.Min(point1.Y,point1.Y);
double maxx = Math.Max(point1.X,point1.X);
double maxy = Math.Max(point1.Y,point1.Y);
RectangleShape rectanglePolygon = new RectangleShape(minx, maxy, maxx, miny);
PolygonShape currentPolygon = rectanglePolygon.ToPolygon();
ShapeFileFeatureLayer polygonLayer = new ShapeFileFeatureLayer("your polygon shape file", ShapeFileReadWriteMode.ReadWrite);
polygonLayer.Open();
Collection<FeatureSourceColumn> polygonColumns = polygonLayer.FeatureSource.GetColumns();
polygonLayer.FeatureSource.BeginTransaction();
Feature newPolygonFeature = new Feature(currentPolygon);
newPolygonFeature.ColumnValues.Add("LabelColumn", "New place");
polygonLayer.FeatureSource.AddFeature(newPolygonFeature);
polygonLayer.FeatureSource.CommitTransaction();
polygonLayer.FeatureSource.Close();
winformsMap1.Refresh();
Hope it helps,
Edgar