Ejemplo n.º 1
0
        void Draw(PaintingRecord record, int startIndex, int endIndex, Graphics graphics, Pen pen)
        {
            GraphicsPath graphicsPath = new GraphicsPath();
            PointF?      start        = null;

            for (int i = startIndex; i <= endIndex; i++)
            {
                var command = record[i];
                if (i >= 1)
                {
                    var ls = record[i - 1];
                    if (ls.Type != CommandType.DrawOpEnd)
                    {
                        start = new PointF(Math.Abs(ls.Coord.X), Math.Abs(ls.Coord.Y));
                    }
                    else
                    {
                        graphicsPath.StartFigure();
                        start = null;
                    }
                }
                PointF point = new PointF(Math.Abs(command.Coord.X), Math.Abs(command.Coord.Y));
                if (start != null)
                {
                    graphicsPath.AddLine(start.Value, point);
                }
                else
                {
                }
            }
            graphics.DrawPath(pen, graphicsPath);
        }
Ejemplo n.º 2
0
        void DoDraw(PaintingRecord record, int startIndex, int endIndex, Graphics graphics, Pen pen)
        {
            Action action = () =>
            {
                Draw(record, startIndex, endIndex, graphics, pen);
            };

            this.BeginInvoke(action);
        }