//Implement a base rendering of an element selection protected internal virtual void RenderHighlight(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (GetPathInternal() == null) { return; } //graphics.FillPath(Component.Instance.HighlightBrush,GetPathInternal()); graphics.DrawPath(Component.Instance.HighlightPen, GetPathInternal()); }
//Renders a graphics marker protected virtual void RenderMarkerAction(MarkerBase marker, PointF markerPoint, PointF referencePoint, Graphics graphics, IRender render, IRenderDesign renderDesign) { if (marker == null) { return; } //Save the graphics state Matrix gstate = graphics.Transform; //Apply the marker transform and render the marker graphics.Transform = GetMarkerTransform(marker, markerPoint, referencePoint, graphics.Transform); marker.RenderAction(graphics, render, renderDesign); //Restore the graphics state graphics.Transform = gstate; }
//Implement a base rendering of an element selection protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderTable(graphics,render); //Render the ports if (Ports != null) { 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); } } } } else { base.RenderAction(graphics,render,renderDesign); } }
//Implement a base rendering of an element selection protected internal virtual void RenderSelection(Graphics graphics, IRender render, IRenderDesign renderDesign) { CreateHandles(); }
//Implement a base rendering of an element selection protected internal override void RenderSelection(Graphics graphics,IRender render,IRenderDesign renderDesign) { CreateHandles(); SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Handle previousHandle=null; SolidBrush brushWhite = new SolidBrush(Color.White); Pen pen = Component.Instance.SelectionStartPen; SolidBrush brush = Component.Instance.SelectionStartBrush; foreach (Handle handle in Handles) { if (previousHandle != null) { graphics.FillPath(brushWhite,previousHandle.Path); graphics.FillPath(brush,previousHandle.Path); graphics.DrawPath(pen,previousHandle.Path); pen = Component.Instance.SelectionPen; //Set to normal brush brush = Component.Instance.SelectionBrush; //Set to normal pen } previousHandle = handle; } graphics.FillPath(brushWhite,previousHandle.Path); graphics.FillPath(Component.Instance.SelectionEndBrush,previousHandle.Path); graphics.DrawPath(Component.Instance.SelectionEndPen,previousHandle.Path); graphics.SmoothingMode = smoothing; }
protected internal override void RenderAction(Graphics graphics, IRender render,IRenderDesign renderDesign) { if (DrawBackground) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderSolid(graphics,render); //Add local clipping Region current = null; if (Clip) { Region region = new Region(GetPathInternal()); current = graphics.Clip; graphics.SetClip(region,CombineMode.Intersect); } //Render annotation and image if (Label != null) Label.RenderAction(graphics,InternalRectangle,render); //Restore clipping if (Clip) graphics.Clip = current; } else { GraphicsPath path = GetPathInternal(); if (path == null) return; graphics.FillPath(Component.Instance.ActionBrush,path); } } if (DrawBorder) base.RenderAction (graphics, render,renderDesign); }
//Implement a base rendering of an element selection protected internal override void RenderSelection(Graphics graphics,IRender render,IRenderDesign renderDesign) { CreateHandles(); RectangleF boundRect = TransformRectangle; float boundsSize = 4 * render.ZoomFactor; float handleSize = 6 * render.ZoomFactor; boundRect.Inflate(boundsSize,boundsSize); graphics.SmoothingMode = SmoothingMode.AntiAlias; SolidBrush brush = new SolidBrush(Color.White); Pen pen = (Pen) Component.Instance.SelectionHatchPen.Clone(); pen.Width = handleSize; graphics.DrawRectangle(pen, -boundsSize, -boundsSize, boundRect.Width, boundRect.Height); foreach (Handle handle in Handles) { if (handle.Type == HandleType.Rotate) { graphics.FillPath(brush,handle.Path); graphics.FillPath(Component.Instance.SelectionRotateBrush,handle.Path); graphics.DrawPath(Component.Instance.SelectionRotatePen,handle.Path); } else { graphics.FillPath(brush,handle.Path); graphics.FillPath(Component.Instance.SelectionBrush,handle.Path); graphics.DrawPath(Component.Instance.SelectionPen,handle.Path); } } graphics.SmoothingMode = SmoothingMode; }
protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (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<Points.Count-1; i++) { location = (PointF) Points[i]; reference = (PointF) Points[i+1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Draw the path GraphicsPath path = GetPathInternal(); if (path == null) return; if (renderDesign.ActionStyle == ActionStyle.Default) { Pen pen = new Pen(render.AdjustColor(BorderColor,BorderWidth,Opacity)); pen.Width = BorderWidth; graphics.DrawPath(pen,path); } else { graphics.DrawPath(Component.Instance.ActionPen,path); } //Reset the clip graphics.Clip = current; //Render the markers for (int i=0;i<Points.Count-1;i++) { segment = Segments[i]; location = (PointF) Points[i]; reference = (PointF) Points[i+1]; if (segment.Start.Marker != null) RenderMarkerAction(segment.Start.Marker,location,reference,graphics,render,renderDesign); } //Render final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; RenderMarkerAction(segment.End.Marker,location,reference,graphics,render,renderDesign); } }
//Implement a base rendering of an element selection protected internal virtual void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderElement(graphics,render); } else { if (GetPathInternal() == null) return; graphics.DrawPath(Component.Instance.ActionPen,GetPathInternal()); } }
//Implement a base rendering of an element selection protected internal virtual void RenderHighlight(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (GetPathInternal() == null) return; //graphics.FillPath(Component.Instance.HighlightBrush,GetPathInternal()); graphics.DrawPath(Component.Instance.HighlightPen,GetPathInternal()); }
//Implement a base rendering of an element selection protected internal virtual void RenderSelection(Graphics graphics,IRender render,IRenderDesign renderDesign) { CreateHandles(); }
protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { base.RenderAction (graphics,render,renderDesign); Region current = null; //Set up clipping if required if (Clip) { Region region = new Region(GetPathInternal()); current = graphics.Clip; graphics.SetClip(region,CombineMode.Intersect); } //Render the children if (Children != null) { foreach (SolidElement solid in RenderList) { graphics.TranslateTransform(solid.Rectangle.X ,solid.Rectangle.Y); solid.RenderAction(graphics,render,renderDesign); graphics.TranslateTransform(-solid.Rectangle.X ,-solid.Rectangle.Y); } } if (Clip) graphics.Clip = current; }
protected internal override void RenderHighlight(Graphics graphics, IRender render, IRenderDesign renderDesign) { graphics.TranslateTransform(mOffset.X, mOffset.Y); base.RenderHighlight(graphics, render, renderDesign); graphics.TranslateTransform(-mOffset.X, -mOffset.Y); }
protected internal override void RenderSelection(Graphics graphics, IRender render, IRenderDesign renderDesign) { CreateHandles(); SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Handle previousHandle = null; SolidBrush brushWhite = new SolidBrush(Color.White); Pen pen = Component.Instance.SelectionStartPen; SolidBrush brush = Component.Instance.SelectionStartBrush; foreach (Handle handle in 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 = Component.Instance.ExpandPen; //Set to normal brush brush = Component.Instance.ExpandBrush; //Set to normal pen } else { pen = Component.Instance.SelectionPen; //Set to normal brush brush = Component.Instance.SelectionBrush; //Set to normal pen } } previousHandle = handle; } graphics.FillPath(brushWhite, previousHandle.Path); graphics.FillPath(Component.Instance.SelectionEndBrush, previousHandle.Path); graphics.DrawPath(Component.Instance.SelectionEndPen, previousHandle.Path); graphics.SmoothingMode = smoothing; }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { base.RenderAction (graphics, render, renderDesign); return; //Render the ports //Port actions are currently not supported 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); } } } }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (DrawBackground) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderSolid(graphics, render); //Add local clipping Region current = null; if (Clip) { Region region = new Region(GetPathInternal()); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render annotation and image if (Label != null) { Label.RenderAction(graphics, InternalRectangle, render); } //Restore clipping if (Clip) { graphics.Clip = current; } } else { GraphicsPath path = GetPathInternal(); if (path == null) { return; } graphics.FillPath(Component.Instance.ActionBrush, path); } } if (DrawBorder) { base.RenderAction(graphics, render, renderDesign); } }
//Implement a base rendering of an element selection protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderTable(graphics, render); //Render the ports if (Ports != null) { 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); } } } } else { base.RenderAction(graphics, render, renderDesign); } }
protected internal override void RenderAction(Graphics graphics, IRender render,IRenderDesign renderDesign) { if (mPoints == null || mPoints.Count < 2) return; PointF startLocation = (PointF) mPoints[0]; PointF startReference = (PointF) mPoints[1]; PointF endLocation = (PointF) mPoints[mPoints.Count-1]; PointF endReference = (PointF) mPoints[mPoints.Count-2]; //Save the current region Region current = graphics.Clip; //Mask out the start marker if (Start.Marker != null) { Region region = new Region(Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(Start.Marker,startLocation,startReference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Mask out the end marker if (End.Marker != null) { Region region = new Region(End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(End.Marker,endLocation,endReference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Render element action base.RenderAction (graphics,render,renderDesign); //Render markers if (Start.Marker != null || End.Marker != null) { graphics.Clip = current; if (Start.Marker != null) RenderMarkerAction(Start.Marker,startLocation,startReference,graphics,render,renderDesign); if (End.Marker != null) RenderMarkerAction(End.Marker,endLocation,endReference,graphics,render,renderDesign); } //Render any ports if (Ports != null) { 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 protected internal override void RenderSelection(Graphics graphics, IRender render, IRenderDesign renderDesign) { CreateHandles(); RectangleF boundRect = TransformRectangle; float boundsSize = 4 * render.ZoomFactor; float handleSize = 6 * render.ZoomFactor; boundRect.Inflate(boundsSize, boundsSize); graphics.SmoothingMode = SmoothingMode.AntiAlias; SolidBrush brush = new SolidBrush(Color.White); Pen pen = (Pen)Component.Instance.SelectionHatchPen.Clone(); pen.Width = handleSize; graphics.DrawRectangle(pen, -boundsSize, -boundsSize, boundRect.Width, boundRect.Height); foreach (Handle handle in Handles) { if (handle.Type == HandleType.Rotate) { graphics.FillPath(brush, handle.Path); graphics.FillPath(Component.Instance.SelectionRotateBrush, handle.Path); graphics.DrawPath(Component.Instance.SelectionRotatePen, handle.Path); } else { graphics.FillPath(brush, handle.Path); graphics.FillPath(Component.Instance.SelectionBrush, handle.Path); graphics.DrawPath(Component.Instance.SelectionPen, handle.Path); } } graphics.SmoothingMode = SmoothingMode; }
//Renders a graphics marker protected virtual void RenderMarkerAction(MarkerBase marker,PointF markerPoint,PointF referencePoint,Graphics graphics,IRender render,IRenderDesign renderDesign) { if (marker == null) return; //Save the graphics state Matrix gstate = graphics.Transform; //Apply the marker transform and render the marker graphics.Transform = GetMarkerTransform(marker,markerPoint,referencePoint,graphics.Transform); marker.RenderAction(graphics,render,renderDesign); //Restore the graphics state graphics.Transform = gstate; }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { base.RenderAction(graphics, render, renderDesign); return; //Render the ports //Port actions are currently not supported 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); } } } }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { base.RenderAction(graphics, render, renderDesign); Region current = null; //Set up clipping if required if (Clip) { Region region = new Region(GetPathInternal()); current = graphics.Clip; graphics.SetClip(region, CombineMode.Intersect); } //Render the children if (Children != null) { foreach (SolidElement solid in RenderList) { graphics.TranslateTransform(solid.Rectangle.X, solid.Rectangle.Y); solid.RenderAction(graphics, render, renderDesign); graphics.TranslateTransform(-solid.Rectangle.X, -solid.Rectangle.Y); } } if (Clip) { graphics.Clip = current; } }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { base.RenderAction (graphics, render, renderDesign); }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { base.RenderAction(graphics, render, renderDesign); }
public virtual void SetFeedback(HandleType mouseHandleType) { if (Diagram == null) { return; } if (!(Diagram.Render is IRenderDesign)) { return; } if (!(Diagram is Diagram)) { return; } Diagram diagram = (Diagram)Diagram; IRenderDesign render = (IRenderDesign)Diagram.Render; if (render.Actions == null) { return; } foreach (Element element in render.Actions) { if (element.ActionElement == diagram.CurrentMouseElements.MouseStartElement) { System.Text.StringBuilder builder = new System.Text.StringBuilder(); string abbrev = Units.Abbreviate(FeedbackUnit); if (element is Shape) { int decimals = Units.DecimalsFromUnit(FeedbackUnit); if (mouseHandleType == HandleType.Move) { PointF location = element.Rectangle.Location; //Check if must translate unit if (FeedbackUnit != DiagramUnit.Pixel) { location = Component.Instance.Units.ConvertPoint(location, FeedbackUnit); } //Round units location = new PointF(Convert.ToSingle(Math.Round(location.X, decimals)), Convert.ToSingle(Math.Round(location.Y, decimals))); builder.Append("x: "); builder.Append(location.X.ToString()); builder.Append(" "); builder.Append(abbrev); builder.Append(" "); builder.Append(" y: "); builder.Append(location.Y.ToString()); builder.Append(" "); builder.Append(abbrev); render.Feedback = builder.ToString(); } else if (mouseHandleType == HandleType.Rotate) { ITransformable transform = (ITransformable)element; builder.Append(Convert.ToSingle(Math.Round(transform.Rotation, decimals)).ToString()); builder.Append(" degrees"); render.Feedback = builder.ToString(); } else { SizeF size = element.Rectangle.Size; //Check if must translate unit if (FeedbackUnit != DiagramUnit.Pixel) { Graphics graphics = Component.Instance.CreateGraphics(); size = Component.Instance.Units.ConvertSize(size, FeedbackUnit); graphics.Dispose(); } //Round units size = new SizeF(Convert.ToSingle(Math.Round(size.Width, decimals)), Convert.ToSingle(Math.Round(size.Height, decimals))); builder.Append("w: "); builder.Append(size.Width.ToString()); builder.Append(" "); builder.Append(abbrev); builder.Append(" "); builder.Append(" h: "); builder.Append(size.Height.ToString()); builder.Append(" "); builder.Append(abbrev); render.Feedback = builder.ToString(); } } } } }
//Implement a base rendering of an element selection protected internal virtual void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (renderDesign.ActionStyle == ActionStyle.Default) { RenderElement(graphics, render); } else { if (GetPathInternal() == null) { return; } graphics.DrawPath(Component.Instance.ActionPen, GetPathInternal()); } }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (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 < Points.Count - 1; i++) { location = (PointF)Points[i]; reference = (PointF)Points[i + 1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker, location, reference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF)Points[Points.Count - 1]; reference = (PointF)Points[Points.Count - 2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker, location, reference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Draw the path GraphicsPath path = GetPathInternal(); if (path == null) { return; } if (renderDesign.ActionStyle == ActionStyle.Default) { Pen pen = new Pen(render.AdjustColor(BorderColor, BorderWidth, Opacity)); pen.Width = BorderWidth; graphics.DrawPath(pen, path); } else { graphics.DrawPath(Component.Instance.ActionPen, path); } //Reset the clip graphics.Clip = current; //Render the markers for (int i = 0; i < Points.Count - 1; i++) { segment = Segments[i]; location = (PointF)Points[i]; reference = (PointF)Points[i + 1]; if (segment.Start.Marker != null) { RenderMarkerAction(segment.Start.Marker, location, reference, graphics, render, renderDesign); } } //Render final marker if (segment.End.Marker != null) { location = (PointF)Points[Points.Count - 1]; reference = (PointF)Points[Points.Count - 2]; RenderMarkerAction(segment.End.Marker, location, reference, graphics, render, renderDesign); } }
protected internal override void RenderHighlight(Graphics graphics, IRender render,IRenderDesign renderDesign) { graphics.TranslateTransform(mOffset.X,mOffset.Y); base.RenderHighlight (graphics,render,renderDesign); graphics.TranslateTransform(-mOffset.X,-mOffset.Y); }
protected internal override void RenderAction(Graphics graphics, IRender render, IRenderDesign renderDesign) { if (mPoints == null || mPoints.Count < 2) { return; } PointF startLocation = (PointF)mPoints[0]; PointF startReference = (PointF)mPoints[1]; PointF endLocation = (PointF)mPoints[mPoints.Count - 1]; PointF endReference = (PointF)mPoints[mPoints.Count - 2]; //Save the current region Region current = graphics.Clip; //Mask out the start marker if (Start.Marker != null) { Region region = new Region(Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(Start.Marker, startLocation, startReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Mask out the end marker if (End.Marker != null) { Region region = new Region(End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(End.Marker, endLocation, endReference, new Matrix())); graphics.SetClip(region, CombineMode.Exclude); } //Render element action base.RenderAction(graphics, render, renderDesign); //Render markers if (Start.Marker != null || End.Marker != null) { graphics.Clip = current; if (Start.Marker != null) { RenderMarkerAction(Start.Marker, startLocation, startReference, graphics, render, renderDesign); } if (End.Marker != null) { RenderMarkerAction(End.Marker, endLocation, endReference, graphics, render, renderDesign); } } //Render any ports if (Ports != null) { 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); } } } }