/// <summary> /// Add a line of specific length to thepage at the current page position /// </summary> /// <param name="length">Length of line in mm</param> /// <param name="options"></param> public void AddLine(double length, LineOptions options = null) { if (options == null) { options = new LineOptions(); } var positionStart = new Position(this.pagePosition.X, this.pagePosition.Y); var postionEnd = new Position(this.pagePosition.X + length, this.pagePosition.Y); var lineWidth = options.LineWidth / this.document.ScaleFactor; this.contents.SaveGraphicsState(); this.contents.SetLineWidth(lineWidth); this.contents.SetColorStroking(options.LineColor); this.contents.DrawLine(positionStart.X, positionStart.Y, postionEnd.X, postionEnd.Y); this.contents.RestoreGraphicsState(); }
/// <summary> /// Return a LineOptions with parameters to set specific properties /// </summary> /// <param name="LineWidth"></param> /// <param name="LineColor"></param> /// <returns></returns> public static LineOptions Set( double?LineWidth = null, Color?LineColor = null ) { var value = new LineOptions(); if (LineWidth.HasValue) { value.LineWidth = LineWidth.Value; } if (LineColor.HasValue) { value.LineColor = LineColor.Value; } return(value); }