This document is archived and information here might be outdated.  Recommended version.


IPointCollection.AddPoint Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IP > IPointCollection Interface > IPointCollection.AddPoint Method
ArcGIS Developer Help

IPointCollection.AddPoint Method

Adds a vertex to a Path, Ring, Polyline, or Polygon; or adds a reference to the input point to a Multipoint, TriangleFan, or TriangleStrip.

[Visual Basic .NET]
Public Sub AddPoint ( _
    ByVal inPoint As IPoint, _
    [ByRef before As Object], _
    [ByRef after As Object] _
)
[C#]
public void AddPoint (
    IPoint inPoint,
    ref object before,
    ref object after
);
[C++]
HRESULT AddPoint(
  IPoint* inPoint,
  Variant* before,
  Variant* after
);
[C++]
Parameters
inPoint 

inPoint is a parameter of type IPoint* before [optional]
before is a parameter of type VARIANT* after [optional]
after is a parameter of type VARIANT*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Adds a Point to a PointCollection.  If before and after are omitted, the Point is added to the end of the PointCollection.  Additionally, by specifying either the before or after index, the Point can be added at a specific location in the PointCollection.

[C#]

    public void AddPointToPointCollection()
    {
        IPoint point = new PointClass();
        point.PutCoords(0, 0);
        object missing = Type.Missing;

        IPointCollection pointCollection = new MultipointClass();
        //We don't specify the before and after object, so we add missing.
        //This adds the point to the end of the PointCollection
        pointCollection.AddPoint(point, ref missing, ref missing);

        System.Windows.Forms.MessageBox.Show(pointCollection.PointCount.ToString());
    }

See Also

IPointCollection Interface

.NET Samples

Move a graphic along a path in ArcMap Move a graphic along a path in ArcMap Creating a toolbar of globe tools Creating a toolbar of globe tools Draw text on a MapControl 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples 3D multipatch examples Reducing schematic nodes and computing a cumulative attribute via a schematic rule StreetMap routing ViperPin tool