IHitTest hitTest = polygon.ShapeCopy as IHitTest;
bool result = hitTest.HitTest(, searchRadius, esriGeometryHitPartType.esriGeometryPartBoundary, hitPoint, ref hitDist, ref hitPartIndex, ref hitSegmentIndex, ref bTrue);
if (result)
{
IGeometryCollection geometryCol = polygon.ShapeCopy as IGeometryCollection;
IPointCollection pathOrRingPointCollection = geometryCol.get_Geometry(hitPartIndex) as IPointCollection;
object hitSegmentIndexObject = new object();
hitSegmentIndexObject = hitSegmentIndex;
object partIndexObject = new object();
partIndexObject = hitPartIndex;
if(hitSegmentIndex == 0)
{
pathOrRingPointCollection.AddPoint(point, 1, Type.Missing);
}
else if(hitSegmentIndex > 0)
{
pathOrRingPointCollection.AddPoint(point, Type.Missing, hitSegmentIndexObject);
}
//remove the old PointCollection from the GeometryCollection and replace with the new one
geometryCol.RemoveGeometries(hitPartIndex, 1);
geometryCol.AddGeometry(pathOrRingPointCollection as IGeometry, ref partIndexObject, Type.Missing);
polygon.Shape = geometryCol as IGeometry;
invalidArea.Invalidate(2);
polygon.Store();