This document is archived and information here might be outdated. Recommended version. |
Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with references to the input points.
[Visual Basic .NET] Public Sub SetPoints ( _ ByVal pPointCollection As IPointCollection4, _ ByRef newPoints As IPoint[] _ )
[C#] public void SetPoints ( IPointCollection4 pPointCollection, ref IPoint[] newPoints );
[C++]
HRESULT SetPoints(
IPointCollection4* pPointCollection,
SAFEARRAY(IPoint)** newPoints
);
[C++] Parameters pPointCollection [in]
pPointCollection is a parameter of type IPointCollection4* newPoints [in]
newPoints is a parameter of type SAFEARRAY(IPoint*)*
All development languages compatible version of IPointCollection::SetPoints .
public void SetPoints()
{
IPoint point1 = new PointClass();
point1.PutCoords(10, 10);
IPoint point2 = new PointClass();
point2.PutCoords(20, 20);
IPoint[] pointArray = new IPoint[2];
pointArray[0] = point1;
pointArray[1] = point2;
IPointCollection4 pointCollection = new MultipointClass();
//add points to pointCollection
IGeometryBridge geometryBridge = new GeometryEnvironmentClass();
geometryBridge.AddPoints(pointCollection, ref pointArray);
PrintPointCollectionSetPoints(pointCollection, "PointCollection before setting points");
//set points - overrides all existing points
IPoint point3 = new PointClass();
point3.PutCoords(30, 30);
IPoint point4 = new PointClass();
point4.PutCoords(40, 40);
IPoint point5 = new PointClass();
point5.PutCoords(50, 50);
IPoint[] secondPointArray = new IPoint[3];
secondPointArray[0] = point3;
secondPointArray[1] = point4;
secondPointArray[2] = point5;
geometryBridge.SetPoints(pointCollection, ref secondPointArray);
PrintPointCollectionSetPoints(pointCollection, "PointCollection after setting points");
}