Esempio n. 1
0
        private void LoadShapesToCanvas(CanvasControl canvas, IEnumerable <LoadedShape> shapes)
        {
            canvas.PreLoad();

            foreach (LoadedShape shape in shapes)
            {
                Pen pen = CreatePen(shape);

                string shapeTypeUpper = shape.ShapeType.ToUpperInvariant();
                switch (shapeTypeUpper)
                {
                case "LINE":
                    DrawableLine line = CreateDrawableLine(shape, pen);
                    canvas.AddLine(line);
                    break;

                case "RECTANGLE":
                    DrawableRectangle rectangle = CreateDrawableRectangle(shape, pen);
                    canvas.AddRectangle(rectangle);
                    break;

                case "ELLIPSE":
                    DrawableEllipse ellipse = CreateDrawableEllipse(shape, pen);
                    canvas.AddEllipse(ellipse);
                    break;
                }
            }

            canvas.ResetView();
        }