Esempio n. 1
0
 public void RenderChildren(RenderInfo renderInfo)
 {
     foreach (Shape child in this.children)
     {
         child.Render(renderInfo);
     }
 }
Esempio n. 2
0
 public void RenderBorder(RenderInfo renderInfo, GraphicsPath path)
 {
     using (var pen = new Pen(this.border.Color, this.border.With))
     {
         renderInfo.Graphics.DrawPath(pen, path);
     }
 }
Esempio n. 3
0
        public void Render(RenderInfo renderInfo)
        {
            var bordered = this.self as HasLineStyle;
            var filled = this.self as HasFillStyle;
            var container = this.self as Container;
            var selectable = this.self as IsSelectable;

            using (GraphicsPath graphicsPath = this.path.Get())
            {
                if (filled != null)
                {
                    filled.RenderFilling(renderInfo, graphicsPath);
                }

                if (container != null)
                {
                    container.RenderChildren(renderInfo);
                }

                if (bordered != null)
                {
                    bordered.RenderBorder(renderInfo, graphicsPath);
                }

                if (selectable != null)
                {
                    selectable.RenderSelection(renderInfo);
                }
            }
        }
Esempio n. 4
0
        public void RenderSelection(RenderInfo renderInfo)
        {
            if (this.IsSelected == false)
            {
                return;
            }

            GraphicsPath path = this.Path.Get();
            RectangleF bounds = path.GetBounds();
            bounds.Inflate(3, 3);
            renderInfo.Graphics.DrawRectangle(Pens.Red, bounds.X, bounds.Y, bounds.Width, bounds.Height);
        }
Esempio n. 5
0
 public void RenderFilling(RenderInfo renderInfo, GraphicsPath path)
 {
     renderInfo.Graphics.FillPath(Brushes.Blue, path);
 }
Esempio n. 6
0
 public void RenderFilling(RenderInfo renderInfo, GraphicsPath path)
 {
     renderInfo.Graphics.FillPath(Brushes.Blue, path);
 }
Esempio n. 7
0
        private void viewPort1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            var renderInfo = new RenderInfo
                                 {
                                         Graphics = e.Graphics
                                 };

            foreach (Shape element in this.elements)
            {
                element.Render(renderInfo);
            }
        }