示例#1
0
 public void RenderChildren(RenderInfo renderInfo)
 {
     foreach (Shape child in this.children)
     {
         child.Render(renderInfo);
     }
 }
示例#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);
     }
 }
示例#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);
                }
            }
        }
示例#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);
        }
示例#5
0
 public void RenderFilling(RenderInfo renderInfo, GraphicsPath path)
 {
     renderInfo.Graphics.FillPath(Brushes.Blue, path);
 }
示例#6
0
 public void RenderFilling(RenderInfo renderInfo, GraphicsPath path)
 {
     renderInfo.Graphics.FillPath(Brushes.Blue, path);
 }
示例#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);
            }
        }