FastColoredTextBoxNS.WavyLineStyle.DrawWavyLine C# (CSharp) Method

DrawWavyLine() private method

private DrawWavyLine ( Graphics graphics, Point start, Point end ) : void
graphics System.Drawing.Graphics
start Point
end Point
return void
        private void DrawWavyLine(Graphics graphics, Point start, Point end)
        {
            if (end.X - start.X < 2)
            {
                graphics.DrawLine(Pen, start, end);
                return;
            }

            var offset = -1;
            var points = new List<Point>();

            for (int i = start.X; i <= end.X; i += 2)
            {
                points.Add(new Point(i, start.Y + offset));
                offset = -offset;
            }

            graphics.DrawLines(Pen, points.ToArray());
        }