public void RenderChildren(RenderInfo renderInfo) { foreach (Shape child in this.children) { child.Render(renderInfo); } }
public void RenderBorder(RenderInfo renderInfo, GraphicsPath path) { using (var pen = new Pen(this.border.Color, this.border.With)) { renderInfo.Graphics.DrawPath(pen, path); } }
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); } } }
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); }
public void RenderFilling(RenderInfo renderInfo, GraphicsPath path) { renderInfo.Graphics.FillPath(Brushes.Blue, path); }
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); } }