CGContext.AddLines(CGPoint[]) Method


Adds the given lines to the current path.

public void AddLines (CoreGraphics.CGPoint[] points);
member this.AddLines : CoreGraphics.CGPoint[] -> unit



An array of two or more PointFs. Straight segments are added between sequential points.


Lines are added to the current path, with the first line segment beginning at points[0]. A line is not added from the GetPathCurrentPoint(). In the following example, the current location of the CGContext is {20,20} after the call to MoveTo(nfloat, nfloat), but as shown in the image, only two line segments are added.

using (var ctxt = UIGraphics.GetCurrentContext ()) {
	var startingPoint = new PointF (20, 20);
	ctxt.MoveTo (startingPoint.X, startingPoint.Y);
	ctxt.SetStrokeColor (UIColor.Red.CGColor);
	var sz = new SizeF (2, 2);
	Func<PointF,PointF> offset = (PointF pt) => new PointF (pt.X - 1, pt.Y - 1);
	ctxt.AddEllipseInRect (new RectangleF (offset (startingPoint), sz));
ctxt.AddLines (new PointF[] {
	new PointF (30, 30),
	new PointF (60, 30),
	new PointF (40, 40)

ctxt.StrokePath ();


Applies to