//Implement a base rendering of an element selection public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { Table table = element as Table; if (render.ActionStyle == ActionStyle.Default) { RenderTable(table, graphics, render); //Render the ports if (table.Ports != null) { foreach (Port port in table.Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-port.Bounds.X + port.Bounds.X, -port.Bounds.Y + port.Bounds.Y); port.SuspendValidation(); IFormsRenderer renderer = render.GetRenderer(port); renderer.RenderElement(port, graphics, render); port.ResumeValidation(); graphics.TranslateTransform(port.Bounds.X - port.Bounds.X, port.Bounds.Y - port.Bounds.Y); } } } } else { base.RenderAction(element, graphics, render); } }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { ComplexShape complex = element as ComplexShape; base.RenderAction(element, graphics, render); Region current = null; //Set up clipping if required if (complex.Clip) { Region region = new Region(complex.GetPath()); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render the children if (complex.Children != null) { foreach (Solid solid in complex.RenderList) { graphics.TranslateTransform(solid.Bounds.X, solid.Bounds.Y); IFormsRenderer renderer = render.GetRenderer(solid); renderer.RenderAction(solid, graphics, render); graphics.TranslateTransform(-solid.Bounds.X, -solid.Bounds.Y); } } if (complex.Clip) { graphics.Clip = current; } }
public override void RenderHighlight(IRenderable element, Graphics graphics, ControlRender render) { Port port = element as Port; graphics.TranslateTransform(port.Offset.X, port.Offset.Y); base.RenderHighlight(element, graphics, render); graphics.TranslateTransform(-port.Offset.X, -port.Offset.Y); }
public override void RenderSelection(IRenderable element, Graphics graphics, ControlRender render) { TableGroup group = element as TableGroup; SmoothingMode mode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.None; Pen pen = Singleton.Instance.SelectionPen; RectangleF rect = new RectangleF(group.Rectangle.X + 2, group.Rectangle.Y, group.Rectangle.Width - 4, group.Rectangle.Height); graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); graphics.SmoothingMode = mode; }
public override void RenderSelection(IRenderable element, Graphics graphics, ControlRender render) { TableRow row = element as TableRow; SmoothingMode mode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.None; Pen pen = Singleton.Instance.SelectionPen; SolidBrush brush = Singleton.Instance.SelectionBrush; RectangleF rect = new RectangleF(row.Rectangle.X + 2, row.Rectangle.Y, row.Rectangle.Width - 4, row.Rectangle.Height); graphics.FillRectangle(brush, rect); graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); graphics.SmoothingMode = mode; }
public override void RenderAction(IRenderable renderable, Graphics graphics, ControlRender render) { Solid solid = renderable as Solid; GraphicsPath path = solid.GetPath(); if (solid.DrawBackground) { if (render.ActionStyle == ActionStyle.Default) { RenderSolid(solid, graphics, render); //Add local clipping Region current = null; if (solid.Clip) { Region region = new Region(path); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render annotation and image if (solid.Label != null) { LabelRender renderer = render.GetRenderer(solid.Label) as LabelRender; renderer.RenderAction(solid.Label, graphics, render, solid.InternalRectangle); } //Restore clipping if (solid.Clip) { graphics.Clip = current; } } else { if (path == null) { return; } graphics.FillPath(Singleton.Instance.ActionBrush, path); } } if (solid.DrawBorder) { base.RenderAction(renderable, graphics, render); } }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { TreeLine line = element as TreeLine; if (line.Points == null || line.Points.Count < 2) { return; } PointF startLocation = (PointF)line.Points[0]; PointF startReference = (PointF)line.Points[1]; PointF endLocation = (PointF)line.Points[line.Points.Count - 1]; PointF endReference = (PointF)line.Points[line.Points.Count - 2]; //Render element action base.RenderAction(element, graphics, render); }
//Implement a base rendering of an element selection public virtual void RenderAction(IRenderable renderable, Graphics graphics, ControlRender render) { Element element = renderable as Element; if (render.ActionStyle == ActionStyle.Default) { RenderElement(renderable, graphics, render); } else { GraphicsPath path = element.GetPath(); if (path == null) { return; } graphics.DrawPath(Singleton.Instance.ActionPen, path); } }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { base.RenderAction(element, graphics, render); //Render the ports //if (Ports != null && renderDesign.ActionStyle == ActionStyle.Default) //{ // foreach (Port port in Ports.Values) // { // if (port.Visible) // { // graphics.TranslateTransform(-Rectangle.X + port.Rectangle.X,-Rectangle.Y + port.Rectangle.Y); // port.SuspendValidation(); // port.Render(graphics,render); // port.ResumeValidation(); // graphics.TranslateTransform(Rectangle.X - port.Rectangle.X,Rectangle.Y - port.Rectangle.Y); // } // } //} }
//Implement a base rendering of an element selection public override void RenderSelection(IRenderable element, Graphics graphics, ControlRender render) { Shape shape = element as Shape; if (shape.Handles == null) { return; } RectangleF boundRect = shape.TransformRectangle; float boundsSize = 4 * render.ZoomFactor; float handleSize = 6 * render.ZoomFactor; boundRect.Inflate(boundsSize, boundsSize); graphics.SmoothingMode = SmoothingMode.None; SolidBrush brush = new SolidBrush(Color.White); SolidBrush fillBrush = (shape.Group == null) ? Singleton.Instance.SelectionBrush : Singleton.Instance.GroupBrush; Pen pen = Singleton.Instance.SelectionHatchPen; graphics.DrawRectangle(pen, -boundsSize, -boundsSize, boundRect.Width, boundRect.Height); foreach (Handle handle in shape.Handles) { if (handle.Type == HandleType.Rotate) { graphics.FillPath(brush, handle.Path); graphics.FillPath(Singleton.Instance.SelectionRotateBrush, handle.Path); graphics.DrawPath(Singleton.Instance.SelectionRotatePen, handle.Path); } else { graphics.FillPath(brush, handle.Path); graphics.FillPath(fillBrush, handle.Path); graphics.DrawPath(Singleton.Instance.SelectionPen, handle.Path); } } graphics.SmoothingMode = shape.SmoothingMode; }
public override void RenderSelection(IRenderable element, Graphics graphics, ControlRender render) { ComplexLine complex = element as ComplexLine; SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Handle previousHandle = null; SolidBrush brushWhite = new SolidBrush(Color.White); Pen pen = Singleton.Instance.SelectionStartPen; SolidBrush brush = Singleton.Instance.SelectionStartBrush; foreach (Handle handle in complex.Handles) { if (previousHandle != null) { graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(brush, previousHandle.Path); graphics.DrawPath(pen, previousHandle.Path); if (handle.Type == HandleType.Expand) { pen = Singleton.Instance.ExpandPen; //Set to normal brush brush = Singleton.Instance.ExpandBrush; //Set to normal pen } else { pen = Singleton.Instance.SelectionPen; //Set to normal brush brush = Singleton.Instance.SelectionBrush; //Set to normal pen } } previousHandle = handle; } graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(Singleton.Instance.SelectionEndBrush, previousHandle.Path); graphics.DrawPath(Singleton.Instance.SelectionEndPen, previousHandle.Path); graphics.SmoothingMode = smoothing; }
//Implement a base rendering of an element selection public virtual void RenderHighlight(IRenderable element, Graphics graphics, ControlRender render) { }
//Implement a base rendering of an element selection public virtual void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { }
//Implement a base rendering of an element selection public virtual void RenderHighlight(IRenderable renderable, Graphics graphics, ControlRender render) { Element element = renderable as Element; GraphicsPath path = element.GetPath(); if (path == null) { return; } //graphics.FillPath(Component.Instance.HighlightBrush,GetPath()); graphics.DrawPath(Singleton.Instance.HighlightPen, path); }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { ComplexLine complex = element as ComplexLine; if (complex.Points == null) { return; } PointF location; PointF reference; Segment segment = null; //Save the current region Region current = graphics.Clip; //Mask out each marker for (int i = 0; i < complex.Points.Count - 1; i++) { location = (PointF)complex.Points[i]; reference = (PointF)complex.Points[i + 1]; segment = complex.Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(segment.Start.Marker, location, reference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF)complex.Points[complex.Points.Count - 1]; reference = (PointF)complex.Points[complex.Points.Count - 2]; Region region = new Region(segment.End.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(segment.End.Marker, location, reference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Draw the path GraphicsPath path = complex.GetPath(); if (path == null) { return; } if (render.ActionStyle == ActionStyle.Default) { Pen pen = new Pen(render.AdjustColor(complex.BorderColor, complex.BorderWidth, complex.Opacity)); pen.Width = complex.BorderWidth; graphics.DrawPath(pen, path); } else { graphics.DrawPath(Singleton.Instance.ActionPen, path); } //Reset the clip graphics.Clip = current; //Render the markers for (int i = 0; i < complex.Points.Count - 1; i++) { segment = complex.Segments[i]; location = (PointF)complex.Points[i]; reference = (PointF)complex.Points[i + 1]; if (segment.Start.Marker != null) { RenderMarkerAction(segment.Start.Marker, location, reference, graphics, render); } } //Render final marker if (segment.End.Marker != null) { location = (PointF)complex.Points[complex.Points.Count - 1]; reference = (PointF)complex.Points[complex.Points.Count - 2]; RenderMarkerAction(segment.End.Marker, location, reference, graphics, render); } }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { base.RenderAction(element, graphics, render); }
public override void RenderAction(IRenderable element, Graphics graphics, ControlRender render) { Link link = element as Link; if (link.Points == null || link.Points.Count < 2) { return; } PointF startLocation = (PointF)link.Points[0]; PointF startReference = (PointF)link.Points[1]; PointF endLocation = (PointF)link.Points[link.Points.Count - 1]; PointF endReference = (PointF)link.Points[link.Points.Count - 2]; startLocation = Geometry.OffsetPoint(startLocation, link.Bounds.Location); startReference = Geometry.OffsetPoint(startReference, link.Bounds.Location); endLocation = Geometry.OffsetPoint(endLocation, link.Bounds.Location); endReference = Geometry.OffsetPoint(endReference, link.Bounds.Location); //Save the current region Region current = graphics.Clip; //Mask out the start marker if (link.Start.Marker != null) { Region region = new Region(link.Start.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(link.Start.Marker, startLocation, startReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Mask out the end marker if (link.End.Marker != null) { Region region = new Region(link.End.Marker.GetPath()); region.Transform(Link.GetMarkerTransform(link.End.Marker, endLocation, endReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Render element action base.RenderAction(element, graphics, render); //Render markers if (link.Start.Marker != null || link.End.Marker != null) { graphics.Clip = current; if (link.Start.Marker != null) { RenderMarkerAction(link.Start.Marker, startLocation, startReference, graphics, render); } if (link.End.Marker != null) { RenderMarkerAction(link.End.Marker, endLocation, endReference, graphics, render); } } //Render any ports if (link.Ports != null) { foreach (Port port in link.Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-link.Bounds.X + port.Bounds.X, -link.Bounds.Y + port.Bounds.Y); port.SuspendValidation(); IFormsRenderer renderer = render.GetRenderer(port); renderer.RenderElement(port, graphics, render); port.ResumeValidation(); graphics.TranslateTransform(link.Bounds.X - port.Bounds.X, link.Bounds.Y - port.Bounds.Y); } } } }
//Implement a base rendering of an element selection public override void RenderSelection(IRenderable renderable, Graphics graphics, ControlRender render) { TreeLine line = renderable as TreeLine; if (line.Handles == null) { return; } SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Handle previousHandle = null; SolidBrush brushWhite = new SolidBrush(Color.White); Pen pen = Singleton.Instance.SelectionStartPen; SolidBrush brush = Singleton.Instance.SelectionStartBrush; foreach (Handle handle in line.Handles) { if (previousHandle != null) { graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(brush, previousHandle.Path); graphics.DrawPath(pen, previousHandle.Path); pen = Singleton.Instance.SelectionPen; //Set to normal brush brush = Singleton.Instance.SelectionBrush; //Set to normal pen } previousHandle = handle; } graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(Singleton.Instance.SelectionEndBrush, previousHandle.Path); graphics.DrawPath(Singleton.Instance.SelectionEndPen, previousHandle.Path); graphics.SmoothingMode = smoothing; }
//Renders a graphics marker protected virtual void RenderMarkerAction(MarkerBase marker, PointF markerPoint, PointF referencePoint, Graphics graphics, ControlRender render) { if (marker == null) { return; } //Save the graphics state Matrix gstate = graphics.Transform; //Apply the marker transform and render the marker graphics.Transform = Link.GetMarkerTransform(marker, markerPoint, referencePoint, graphics.Transform); IFormsRenderer renderer = render.GetRenderer(marker); renderer.RenderAction(marker, graphics, render); //Restore the graphics state graphics.Transform = gstate; }