protected internal override Rectangle[] GetConnectors() { if (!Expanded || ContainedDesigners.Count > 0 || ShowPreview || ActiveDesigner != this) { return new Rectangle[] { } } ; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; int headerHeight = ambientTheme.Margin.Height; headerHeight += this.previewStrip.Size.Height; headerHeight += ambientTheme.Margin.Height; //We need to adjust the first and last connectors so as to adjust the //start and end indicator heights Rectangle[] connectors = base.GetConnectors(); if (connectors.Length > 0) { connectors[0].Y = connectors[0].Y + headerHeight; connectors[0].Height -= headerHeight; } return(connectors); }
public ConnectorDragDropGlyph(int connectorIndex, Point connectorCenter) { this.connectorIndex = connectorIndex; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; this.glyphPoint = new Point(connectorCenter.X - (ambientTheme.DropIndicatorSize.Width / 2), connectorCenter.Y - (ambientTheme.DropIndicatorSize.Height / 2)); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = this.GetBounds(designer, activated); bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin); ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ReadOnlyImage, bounds, DesignerContentAlignment.TopLeft); }
private DesignerGlyph[] CreateConnectorDragDropGlyphs() { WorkflowView parentView = base.ParentView; DragDropManager service = base.GetService(typeof(DragDropManager)) as DragDropManager; if (((parentView == null) || (service == null)) || (!parentView.DragDropInProgress || (base.DrawingState != ActivityDesigner.DrawingStates.Valid))) { return(new DesignerGlyph[0]); } List <DesignerGlyph> list = new List <DesignerGlyph>(); Rectangle rectangle = parentView.ClientRectangleToLogical(new Rectangle(Point.Empty, parentView.ViewPortSize)); AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; Rectangle[] connectors = this.GetConnectors(); Rectangle helpTextRectangle = this.HelpTextRectangle; for (int i = 0; i < connectors.Length; i++) { if ((rectangle.IntersectsWith(connectors[i]) && (i != this.CurrentDropTarget)) && service.IsValidDropContext(new ConnectorHitTestInfo(this, HitTestLocations.Designer, i))) { Point empty = Point.Empty; if (helpTextRectangle.IsEmpty) { empty = new Point((connectors[i].Location.X + (connectors[i].Size.Width / 2)) + 1, connectors[i].Location.Y + (connectors[i].Size.Height / 2)); } else { empty = new Point((helpTextRectangle.Left + (helpTextRectangle.Width / 2)) + 1, helpTextRectangle.Top - (ambientTheme.DropIndicatorSize.Height / 2)); } list.Add(new ConnectorDragDropGlyph(i, empty)); } } return(list.ToArray()); }
public override void OnPaint(PaintEventArgs e, ViewPortData viewPortData) { Graphics graphics = e.Graphics; Bitmap memoryBitmap = viewPortData.MemoryBitmap; Rectangle rect = new Rectangle(Point.Empty, memoryBitmap.Size); graphics.FillRectangle(AmbientTheme.WorkspaceBackgroundBrush, rect); if (((base.parentView.RootDesigner != null) && (base.parentView.RootDesigner.Bounds.Width >= 0)) && (base.parentView.RootDesigner.Bounds.Height >= 0)) { GraphicsContainer container = graphics.BeginContainer(); Matrix matrix = new Matrix(); matrix.Scale(viewPortData.Scaling.Width, viewPortData.Scaling.Height, MatrixOrder.Prepend); Point[] pts = new Point[] { viewPortData.LogicalViewPort.Location }; matrix.TransformPoints(pts); matrix.Translate((float)(-pts[0].X + viewPortData.ShadowDepth.Width), (float)(-pts[0].Y + viewPortData.ShadowDepth.Height), MatrixOrder.Append); graphics.Transform = matrix; using (Region region = new Region(ActivityDesignerPaint.GetDesignerPath(base.parentView.RootDesigner, false))) { Region clip = graphics.Clip; graphics.Clip = region; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; graphics.FillRectangle(Brushes.White, base.parentView.RootDesigner.Bounds); if (ambientTheme.WorkflowWatermarkImage != null) { ActivityDesignerPaint.DrawImage(graphics, ambientTheme.WorkflowWatermarkImage, base.parentView.RootDesigner.Bounds, new Rectangle(Point.Empty, ambientTheme.WorkflowWatermarkImage.Size), ambientTheme.WatermarkAlignment, 0.25f, false); } graphics.Clip = clip; } graphics.EndContainer(container); } }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { Connector connectorEdited = null; ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService; foreach (object obj2 in service.GetSelectedComponents()) { Connector connectorFromSelectedObject = Connector.GetConnectorFromSelectedObject(obj2); if (connectorFromSelectedObject != null) { connectorFromSelectedObject.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connectorFromSelectedObject.ParentDesigner.Bounds, viewPort, connectorFromSelectedObject.ParentDesigner.DesignerTheme), obj2 == service.PrimarySelection, new Point[0]); if (obj2 == service.PrimarySelection) { connectorEdited = connectorFromSelectedObject; } } } if (connectorEdited != null) { new ConnectorEditor(connectorEdited).OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, connectorEdited.ParentDesigner.Bounds, viewPort, connectorEdited.ParentDesigner.DesignerTheme), true, true); } if (this.EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return(false); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Bitmap bitmap = Resources.Executing; bitmap.MakeTransparent(Color.FromArgb(0, 255, 255)); if (bitmap != null) graphics.DrawImage(bitmap, GetBounds(designer, activated), new Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel); }
public static Point[] Route(IServiceProvider serviceProvider, object source, object target, ICollection <Rectangle> userDefinedRoutingObstacles) { List <Rectangle> list; List <Point> list2; List <Point> list3; GetRoutingObstacles(serviceProvider, source, target, out list, out list2, out list3); if (userDefinedRoutingObstacles != null) { list.AddRange(userDefinedRoutingObstacles); } ActivityDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(serviceProvider); AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; Point begin = (source is ConnectionPoint) ? ((ConnectionPoint)source).Location : ((Point)source); Point end = (target is ConnectionPoint) ? ((ConnectionPoint)target).Location : ((Point)target); Point[] segments = ConnectorRouter.Route(begin, end, new Size(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height), safeRootDesigner.Bounds, list.ToArray(), list2.ToArray(), list3.ToArray()); if (!AreAllSegmentsVerticalOrHorizontal(segments)) { segments = ConnectorRouter.Route(begin, end, ambientTheme.Margin, safeRootDesigner.Bounds, new Rectangle[0], list2.ToArray(), new Point[0]); } if (!AreAllSegmentsVerticalOrHorizontal(segments)) { Point point3 = (DesignerGeometryHelper.SlopeOfLineSegment(begin, end) < 1f) ? new Point(end.X, begin.Y) : new Point(begin.X, end.Y); segments = new Point[] { begin, point3, end }; } return(segments); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = this.GetBounds(designer, activated); Rectangle[] grabHandles = new Rectangle[] { new Rectangle((bounds.X + (bounds.Width / 2)) - (ambientTheme.SelectionSize.Width / 2), bounds.Y, ambientTheme.SelectionSize.Width, ambientTheme.SelectionSize.Height), new Rectangle((bounds.X + (bounds.Width / 2)) - (ambientTheme.SelectionSize.Width / 2), bounds.Bottom - ambientTheme.SelectionSize.Height, ambientTheme.SelectionSize.Width, ambientTheme.SelectionSize.Height) }; ActivityDesignerPaint.DrawGrabHandles(graphics, grabHandles, base.isPrimarySelectionGlyph); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, activated); graphics.FillRectangle(AmbientTheme.FadeBrush, bounds); graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds); graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds); }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { //Draw the selected connectors at top of the z level Connector selectedConnector = null; ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; foreach (object selectedComponents in selectionService.GetSelectedComponents()) { Connector connector = Connector.GetConnectorFromSelectedObject(selectedComponents); if (connector != null) { connector.OnPaintSelected(new ActivityDesignerPaintEventArgs(e.Graphics, connector.ParentDesigner.Bounds, viewPort, connector.ParentDesigner.DesignerTheme), (selectedComponents == selectionService.PrimarySelection), new Point[] { }); if (selectedComponents == selectionService.PrimarySelection) { selectedConnector = connector; } } } //Draw selected connector adorned with the edit points if (selectedConnector != null) { ConnectorEditor editableConnector = new ConnectorEditor(selectedConnector); editableConnector.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, selectedConnector.ParentDesigner.Bounds, viewPort, selectedConnector.ParentDesigner.DesignerTheme), true, true); } //If editing is in progress then draw the connector being edited if (EditingInProgress) { FreeformActivityDesigner designer = (this.connectorEditor.EditedConnector.ParentDesigner != null) ? this.connectorEditor.EditedConnector.ParentDesigner : ConnectionManager.GetConnectorContainer(this.connectorEditor.EditedConnector.Source.AssociatedDesigner); this.connectorEditor.OnPaint(new ActivityDesignerPaintEventArgs(e.Graphics, designer.Bounds, viewPort, designer.DesignerTheme), false, false); } return(false); }
// public override void OnPaint(PaintEventArgs e, ViewPortData viewPortData) { Graphics graphics = e.Graphics; Debug.Assert(graphics != null); //Get the drawing canvas Bitmap memoryBitmap = viewPortData.MemoryBitmap; Debug.Assert(memoryBitmap != null); //Fill the background using the workspace color so that we communicate the paging concept Rectangle workspaceRectangle = new Rectangle(Point.Empty, memoryBitmap.Size); graphics.FillRectangle(AmbientTheme.WorkspaceBackgroundBrush, workspaceRectangle); if (this.parentView.RootDesigner != null && this.parentView.RootDesigner.Bounds.Width >= 0 && this.parentView.RootDesigner.Bounds.Height >= 0) { GraphicsContainer graphicsState = graphics.BeginContainer(); //Create the scaling matrix Matrix transformationMatrix = new Matrix(); transformationMatrix.Scale(viewPortData.Scaling.Width, viewPortData.Scaling.Height, MatrixOrder.Prepend); //When we draw on the viewport we draw in scaled and translated. //So that we minimize the calls to DrawImage //Make sure that we scale down the logical view port origin in order to take care of scaling factor //Before we select the transform factor we make sure that logicalviewport origin is scaled down Point[] logicalViewPortOrigin = new Point[] { viewPortData.LogicalViewPort.Location }; transformationMatrix.TransformPoints(logicalViewPortOrigin); //For performance improvement and to eliminate one extra DrawImage...we draw the designers on the viewport //bitmap with visual depth consideration transformationMatrix.Translate(-logicalViewPortOrigin[0].X + viewPortData.ShadowDepth.Width, -logicalViewPortOrigin[0].Y + viewPortData.ShadowDepth.Height, MatrixOrder.Append); //Select the transform into viewport graphics. //Viewport bitmap has the scaled and translated designers which we then map to //the actual graphics based on page layout graphics.Transform = transformationMatrix; using (Region clipRegion = new Region(ActivityDesignerPaint.GetDesignerPath(this.parentView.RootDesigner, false))) { Region oldRegion = graphics.Clip; graphics.Clip = clipRegion; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; graphics.FillRectangle(Brushes.White, this.parentView.RootDesigner.Bounds); if (ambientTheme.WorkflowWatermarkImage != null) { ActivityDesignerPaint.DrawImage(graphics, ambientTheme.WorkflowWatermarkImage, this.parentView.RootDesigner.Bounds, new Rectangle(Point.Empty, ambientTheme.WorkflowWatermarkImage.Size), ambientTheme.WatermarkAlignment, AmbientTheme.WatermarkTransparency, false); } graphics.Clip = oldRegion; } graphics.EndContainer(graphicsState); } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { if (!this.GetBounds(designer, activated).Size.IsEmpty) { bool roundEdges = (designer.DesignerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle) && !designer.IsRootDesigner; ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, 4, LightSourcePosition.Top | LightSourcePosition.Left, 0.5f, roundEdges); } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, activated); Rectangle[] grabHandles = new Rectangle[2]; grabHandles[0] = new Rectangle(bounds.X + bounds.Width / 2 - ambientTheme.SelectionSize.Width / 2, bounds.Y, ambientTheme.SelectionSize.Width, ambientTheme.SelectionSize.Height); grabHandles[1] = new Rectangle(bounds.X + bounds.Width / 2 - ambientTheme.SelectionSize.Width / 2, bounds.Bottom - ambientTheme.SelectionSize.Height, ambientTheme.SelectionSize.Width, ambientTheme.SelectionSize.Height); ActivityDesignerPaint.DrawGrabHandles(graphics, grabHandles, this.isPrimarySelectionGlyph); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, activated); if (!bounds.Size.IsEmpty) { bool drawRounded = (designer.DesignerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle && !designer.IsRootDesigner); ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, AmbientTheme.DropShadowWidth, LightSourcePosition.Left | LightSourcePosition.Top, 0.5f, drawRounded); } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { if (designer == null) throw new ArgumentNullException("designer"); if (graphics == null) throw new ArgumentNullException("graphics"); Rectangle bounds = GetBounds(designer, false); graphics.FillRectangle(StateMachineDesignerPaint.FadeBrush, bounds); graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds); graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { if (((designer.Activity != null) && (designer.Activity.Site != null)) && (this.connectionPoint != null)) { WorkflowView service = designer.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView; Rectangle viewPort = (service != null) ? service.ViewPortRectangle : Rectangle.Empty; Rectangle clipRectangle = (designer.ParentDesigner != null) ? designer.ParentDesigner.Bounds : designer.Bounds; ConnectionManager manager = designer.Activity.Site.GetService(typeof(ConnectionManager)) as ConnectionManager; ActivityDesignerPaintEventArgs e = new ActivityDesignerPaintEventArgs(graphics, clipRectangle, viewPort, designer.DesignerTheme); bool drawHighlighted = (manager != null) && this.connectionPoint.Equals(manager.SnappedConnectionPoint); this.connectionPoint.OnPaint(e, drawHighlighted); } }
protected override bool OnPaint(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { if (this.dragStarted) { using (Brush dragRectangleBrush = new SolidBrush(Color.FromArgb(10, ambientTheme.SelectionForeColor))) { Rectangle dragRectangle = DragRectangle; e.Graphics.FillRectangle(dragRectangleBrush, dragRectangle.X, dragRectangle.Y, dragRectangle.Width - 1, dragRectangle.Height - 1); e.Graphics.DrawRectangle(ambientTheme.SelectionForegroundPen, dragRectangle.X, dragRectangle.Y, dragRectangle.Width - 1, dragRectangle.Height - 1); } } return(false); }
private void InvalidateDraggedImages(Point[] locations) { if ((this.draggedDesignerImages != null) && (locations.Length == this.draggedDesignerImages.Count)) { AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; WorkflowView parentView = base.ParentView; for (int i = 0; i < this.draggedDesignerImages.Count; i++) { Rectangle logicalRectangle = new Rectangle(locations[i], this.draggedDesignerImages[i].Size); logicalRectangle.Inflate(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height); parentView.InvalidateLogicalRectangle(logicalRectangle); } } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, false); Rectangle activatedBounds = GetBounds(designer, activated); Region clipRegion = null; Region oldClipRegion = graphics.Clip; try { if (oldClipRegion != null) { clipRegion = oldClipRegion.Clone(); if (activated) { clipRegion.Union(activatedBounds); } graphics.Clip = clipRegion; } if (activated) { graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds); graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1); activatedBounds.X += bounds.Width + ambientTheme.Margin.Width; activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width); using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down)) { graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator); graphics.DrawPath(SystemPens.ControlText, dropDownIndicator); } } ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill); } finally { if (clipRegion != null) { graphics.Clip = oldClipRegion; clipRegion.Dispose(); } } }
public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { Rectangle itemBounds = this.parentDesigner.previewStrip.GetItemBounds(this.item); Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; glyphSize.Width = (glyphSize.Width * 3) / 4; glyphSize.Height = (glyphSize.Height * 3) / 4; Point location = new Point(itemBounds.Right - (glyphSize.Width / 2), itemBounds.Top - (glyphSize.Height / 2)); itemBounds = new Rectangle(location, glyphSize); if (activated) { itemBounds.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; itemBounds.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return(itemBounds); }
protected internal override Rectangle[] GetConnectors() { if ((!this.Expanded || (this.ContainedDesigners.Count > 0)) || (this.ShowPreview || (base.ActiveDesigner != this))) { return(new Rectangle[0]); } AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; int num = ambientTheme.Margin.Height + this.previewStrip.Size.Height; num += ambientTheme.Margin.Height; Rectangle[] connectors = base.GetConnectors(); if (connectors.Length > 0) { connectors[0].Y += num; connectors[0].Height -= num; } return(connectors); }
public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) { throw new ArgumentNullException("designer"); } Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Point location = new Point((designer.Bounds.Right - glyphSize.Width) - (margin.Width / 2), (designer.Bounds.Top - glyphSize.Height) + margin.Height); Rectangle rectangle = new Rectangle(location, glyphSize); if (activated) { rectangle.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; rectangle.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return(rectangle); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, false); Rectangle activatedBounds = GetBounds(designer, activated); Region clipRegion = null; Region oldClipRegion = graphics.Clip; try { if (oldClipRegion != null) { clipRegion = oldClipRegion.Clone(); if (activated) clipRegion.Union(activatedBounds); graphics.Clip = clipRegion; } if (activated) { graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds); graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1); activatedBounds.X += bounds.Width + ambientTheme.Margin.Width; activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width); using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down)) { graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator); graphics.DrawPath(SystemPens.ControlText, dropDownIndicator); } } ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill); } finally { if (clipRegion != null) { graphics.Clip = oldClipRegion; clipRegion.Dispose(); } } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle frameRect = Bounds; Rectangle shadowRect = frameRect; Color BaseColor = Color.FromArgb(150, 0, 0, 0); // dark semitransparent backdrop Color LightingColor = Color.FromArgb(150, 0, 0, 0); Brush frameBrush = new LinearGradientBrush(new Point(frameRect.Left, frameRect.Top), new Point(frameRect.Left, frameRect.Bottom), BaseColor, LightingColor); shadowRect = DropRoundedRectangleShadow(shadowRect, graphics); graphics.FillPath(frameBrush, RoundedRect(frameRect)); graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; foreach (ActivityDesigner highlightedDesigner in HighlightedDesigners) { DesignerPainter.PaintDesigner(highlightedDesigner, new ActivityDesignerPaintEventArgs(graphics, designer.Bounds, designer.Bounds, null)); } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = this.GetBounds(designer, false); Rectangle rect = this.GetBounds(designer, activated); Region region = null; Region clip = graphics.Clip; try { if (clip != null) { region = clip.Clone(); if (activated) { region.Union(rect); } graphics.Clip = region; } if (activated) { graphics.FillRectangle(SystemBrushes.ButtonFace, rect); graphics.DrawRectangle(SystemPens.ControlDarkDark, rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); rect.X += bounds.Width + ambientTheme.Margin.Width; rect.Width -= bounds.Width + (2 * ambientTheme.Margin.Width); using (GraphicsPath path = ActivityDesignerPaint.GetScrollIndicatorPath(rect, ScrollButton.Down)) { graphics.FillPath(SystemBrushes.ControlText, path); graphics.DrawPath(SystemPens.ControlText, path); } } ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill); } finally { if (region != null) { graphics.Clip = clip; region.Dispose(); } } }
public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { if (designer == null) { throw new ArgumentNullException("designer"); } Size configErrorSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Point configErrorLocation = new Point(designer.Bounds.Right - configErrorSize.Width - margin.Width / 2, designer.Bounds.Top - configErrorSize.Height + margin.Height); Rectangle bounds = new Rectangle(configErrorLocation, configErrorSize); if (activated) { bounds.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; bounds.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return(bounds); }
public override void OnPaint(PaintEventArgs e, ViewPortData viewPortData) { Graphics graphics = e.Graphics; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; Bitmap memoryBitmap = viewPortData.MemoryBitmap; graphics.FillRectangle(Brushes.White, new Rectangle(Point.Empty, memoryBitmap.Size)); if (ambientTheme.WorkflowWatermarkImage != null) { GraphicsContainer container = graphics.BeginContainer(); Matrix matrix = new Matrix(); matrix.Scale(viewPortData.Scaling.Width, viewPortData.Scaling.Height, MatrixOrder.Prepend); matrix.Invert(); Point[] pts = new Point[] { viewPortData.Translation, new Point(viewPortData.ViewPortSize) }; matrix.TransformPoints(pts); Rectangle rect = new Rectangle(pts[0], new Size(pts[1])); matrix = new Matrix(); matrix.Scale((viewPortData.Scaling.Width / ((float)base.parentView.Zoom)) * 100f, (viewPortData.Scaling.Height / ((float)base.parentView.Zoom)) * 100f); Matrix matrix2 = new Matrix(); matrix2.Scale(((float)base.parentView.Zoom) / 100f, ((float)base.parentView.Zoom) / 100f); graphics.Transform = matrix2; foreach (PageLayoutData data in this.pageLayoutInfo) { if (data.PageBounds.IntersectsWith(rect)) { Rectangle empty = Rectangle.Empty; empty.X = data.LogicalPageBounds.X - viewPortData.LogicalViewPort.X; empty.Y = data.LogicalPageBounds.Y - viewPortData.LogicalViewPort.Y; empty.Width = data.LogicalPageBounds.Width; empty.Height = data.LogicalPageBounds.Height; pts = new Point[] { empty.Location, new Point(empty.Size) }; matrix.TransformPoints(pts); empty.Location = pts[0]; empty.Size = new Size(pts[1]); ActivityDesignerPaint.DrawImage(graphics, ambientTheme.WorkflowWatermarkImage, empty, new Rectangle(Point.Empty, ambientTheme.WorkflowWatermarkImage.Size), ambientTheme.WatermarkAlignment, 0.25f, false); } } graphics.EndContainer(container); } }
public override Rectangle GetBounds(ActivityDesigner designer, bool activated) { Rectangle rectangle = this.parentDesigner.previewStrip.GetItemBounds(this.item); Size configErrorSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; configErrorSize.Width = configErrorSize.Width * 3 / 4; configErrorSize.Height = configErrorSize.Height * 3 / 4; Point configErrorLocation = new Point(rectangle.Right - configErrorSize.Width / 2, rectangle.Top - configErrorSize.Height / 2); rectangle = new Rectangle(configErrorLocation, configErrorSize); if (activated) { rectangle.Width *= 2; AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; rectangle.Inflate(ambientTheme.Margin.Width / 2, ambientTheme.Margin.Height / 2); } return(rectangle); }
private DesignerGlyph[] CreateConnectorDragDropGlyphs() { //see if there's a drag'n'drop operation going on WorkflowView parentView = ParentView; DragDropManager dragDropManager = GetService(typeof(DragDropManager)) as DragDropManager; if (parentView == null || dragDropManager == null || !parentView.DragDropInProgress || DrawingState != DrawingStates.Valid) { return new DesignerGlyph[] { } } ; List <DesignerGlyph> glyphs = new List <DesignerGlyph>(); Rectangle logicalViewPort = parentView.ClientRectangleToLogical(new Rectangle(Point.Empty, parentView.ViewPortSize)); AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; Rectangle[] connectors = GetConnectors(); Rectangle helpTextRectangle = HelpTextRectangle; for (int i = 0; i < connectors.Length; i++) { if (logicalViewPort.IntersectsWith(connectors[i]) && i != CurrentDropTarget && dragDropManager.IsValidDropContext(new ConnectorHitTestInfo(this, HitTestLocations.Designer, i))) { Point glyphLocation = Point.Empty; if (helpTextRectangle.IsEmpty) { glyphLocation = new Point(connectors[i].Location.X + connectors[i].Size.Width / 2 + 1, connectors[i].Location.Y + connectors[i].Size.Height / 2); } else { glyphLocation = new Point(helpTextRectangle.Left + helpTextRectangle.Width / 2 + 1, helpTextRectangle.Top - ambientTheme.DropIndicatorSize.Height / 2); } glyphs.Add(new ConnectorDragDropGlyph(i, glyphLocation)); } } return(glyphs.ToArray()); }
private void InvalidateDraggedImages(Point[] locations) { if (this.draggedDesignerImages != null) { if (locations.Length == this.draggedDesignerImages.Count) { AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme; WorkflowView parentView = ParentView; //Invalidate the previous location where image was shown for (int i = 0; i < this.draggedDesignerImages.Count; i++) { Rectangle rectangle = new Rectangle(locations[i], this.draggedDesignerImages[i].Size); rectangle.Inflate(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height); parentView.InvalidateLogicalRectangle(rectangle); } } else { Debug.Assert(false); } } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle bounds = GetBounds(designer, activated); bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin); ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ReadOnlyImage, bounds, DesignerContentAlignment.TopLeft); }
public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { Size selectionSize = ambientTheme.SelectionSize; int x = Location.X + EventDrivenPadding; int y = Location.Y + EventDrivenPadding; foreach (Layout layout in this.Layouts) { layout.Location = new Point(x, y); DesignerLayoutBase designerLayout = layout as DesignerLayoutBase; if (designerLayout != null) designerLayout.ActivityDesigner.Location = layout.Location; layout.OnLayoutPosition(graphics, designerTheme, ambientTheme); y += layout.Size.Height + selectionSize.Height; } }
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { Image image = this.ActivityDesigner.Image; if (image != null) ActivityDesignerPaint.DrawImage(graphics, image, this.Bounds, DesignerContentAlignment.Fill); }
protected override bool OnPaintWorkflowAdornments(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { for (int i = 0; i < this.actions.Count; i++) { GraphicsContainer container = e.Graphics.BeginContainer(); Point location = this.GetActionBounds(i).Location; e.Graphics.TranslateTransform((float) location.X, (float) location.Y); this.actions[i].Draw(e.Graphics); e.Graphics.EndContainer(container); } return false; }
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { ActivityDesigner activityDesigner = this.ActivityDesigner; if (this.MouseOver) { using (Font font = new Font(designerTheme.Font, FontStyle.Underline | designerTheme.Font.Style)) { Image image = StateDesigner.GetDesignerImage(activityDesigner); if (image != null) ActivityDesignerPaint.DrawImage(graphics, image, this.ImageRectangle, DesignerContentAlignment.Fill); ActivityDesignerPaint.DrawText(graphics, font, this.Text, TextRectangle, StringAlignment.Near, ambientTheme.TextQuality, designerTheme.ForegroundBrush); } } else base.OnPaint(graphics, designerTheme, ambientTheme); }
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { Rectangle rectangle = this.Bounds; Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds); graphics.FillRectangle(backgroundBrush, rectangle); Color color1; Color color2; StateActivity state = (StateActivity)this.ActivityDesigner.Activity; if (StateMachineHelpers.IsLeafState(state)) { color1 = Color.FromArgb(32, designerTheme.BorderColor); color2 = Color.FromArgb(160, designerTheme.BorderColor); } else { if (StateMachineHelpers.IsRootState(state)) { color1 = Color.Empty; color2 = Color.FromArgb(128, designerTheme.BorderColor); } else { color1 = Color.FromArgb(16, designerTheme.BorderColor); color2 = Color.FromArgb(16, designerTheme.BorderColor); } } if (rectangle.Width > 0 && rectangle.Height > 0) { using (Brush linearGradientBrush = new LinearGradientBrush(rectangle, color1, color2, LinearGradientMode.Vertical)) { graphics.FillRectangle(linearGradientBrush, rectangle); graphics.DrawLine(designerTheme.BorderPen, rectangle.Left, rectangle.Bottom, rectangle.Right, rectangle.Bottom); } } base.OnPaint(graphics, designerTheme, ambientTheme); }
public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Point origin = this.Location; origin.X += margin.Width; origin.Y += 2; _imageLayout.Location = origin; CalculateTextLayout(); }
public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize) { base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize); Size minimumSize = new Size(); _textLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, Size.Empty); _imageLayout.OnLayoutSize(graphics, designerTheme, ambientTheme, Size.Empty); minimumSize.Width = designerTheme.BorderWidth * 2 + 10 + _textLayout.Size.Width + _imageLayout.Size.Width; minimumSize.Height = Math.Max(_textLayout.Size.Height, _imageLayout.Size.Height); minimumSize.Height += designerTheme.BorderWidth * 2 + 4; this.MinimumSize = minimumSize; Size size = minimumSize; size.Width = Math.Max(minimumSize.Width, containerSize.Width); this.Size = size; }
public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize) { Size selectionSize = ambientTheme.SelectionSize; Size minimumSize = new Size(); foreach (Layout layout in Layouts) { layout.OnLayoutSize(graphics, designerTheme, ambientTheme, minimumSize); minimumSize.Height += layout.Size.Height; minimumSize.Height += selectionSize.Height; int layoutWidth = layout.Size.Width + 2 * (selectionSize.Width + ambientTheme.Margin.Width); minimumSize.Width = Math.Max(minimumSize.Width, layoutWidth); } if (this.Layouts.Count > 0) minimumSize.Height += EventDrivenPadding; this.MinimumSize = minimumSize; Size size = new Size(); size.Width = Math.Max(containerSize.Width, minimumSize.Height); size.Height = minimumSize.Height; this.Size = size; }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { image.MakeTransparent(Color.FromArgb(255, 255, 255)); if (image != null) { graphics.DrawImage(image, GetBounds(designer, activated), new Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel); } }
public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize) { base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize); CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme; Size size = Size.Empty; if (this.ActivityDesigner.Image != null && compositeDesignerTheme != null) { size = designerTheme.ImageSize; } this.MinimumSize = size; this.Size = size; }
public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize) { base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize); InitializeLayouts(); CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme; if (compositeDesignerTheme == null) return; Font font = designerTheme.BoldFont; _breadCrumbSeparatorSize = StateMachineDesignerPaint.MeasureString(graphics, font, BreadCrumbSeparator, StringAlignment.Near, Size.Empty); Size size = Size.Empty; foreach (Layout layout in Layouts) { layout.OnLayoutSize(graphics, compositeDesignerTheme, ambientTheme, size); size.Width += layout.Size.Width + _breadCrumbSeparatorSize.Width; size.Height = Math.Max(size.Height, layout.Size.Height); } this.MinimumSize = size; this.Size = size; }
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { base.OnPaint(graphics, designerTheme, ambientTheme); StateDesigner stateDesigner = (StateDesigner)this.ActivityDesigner; ContainedDesignersParser parser = stateDesigner._designersParser; // we only draw the separation line // if we have at least one event driven and one state if ((parser.EventDrivenDesigners.Count > 0 || parser.StateInitializationDesigners.Count > 0 || parser.StateFinalizationDesigners.Count > 0) && (parser.StateDesigners.Count > 0 || parser.LeafStateDesigners.Count > 0)) { Rectangle bounds = this.Bounds; graphics.DrawLine(designerTheme.BorderPen, bounds.Left, bounds.Bottom, bounds.Right, bounds.Bottom); } }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.DropIndicatorImage, this.GetBounds(designer, activated), DesignerContentAlignment.Fill); }
public override void OnLayoutPosition(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { Point location = this.Location; foreach (Layout layout in this.Layouts) { layout.Location = location; layout.OnLayoutPosition(graphics, designerTheme, ambientTheme); location.X += layout.Size.Width + _breadCrumbSeparatorSize.Width; } }
protected abstract void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer);
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { if (Layouts.Count == 0) return; Font font = designerTheme.BoldFont; TextQuality textQuality = ambientTheme.TextQuality; Brush brush = designerTheme.ForegroundBrush; List<Layout> layouts = this.Layouts; Layout layout; for (int i = 0; i < layouts.Count - 1; i++) { layout = layouts[i]; layout.OnPaint(graphics, designerTheme, ambientTheme); Rectangle separatorRectangle = new Rectangle( layout.Bounds.Right, layout.Location.Y, _breadCrumbSeparatorSize.Width, _breadCrumbSeparatorSize.Height); ActivityDesignerPaint.DrawText(graphics, font, BreadCrumbSeparator, separatorRectangle, StringAlignment.Near, textQuality, brush); } // draw the last one layout = layouts[layouts.Count - 1]; layout.OnPaint(graphics, designerTheme, ambientTheme); }
protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer) { Rectangle activatedBounds = GetBounds(designer, true); bool formShown = false; //if the drop down form is shown, draw the arrow up if (Form.ActiveForm != null && Form.ActiveForm.GetType().FullName.Equals(typeof(ItemPalette).FullName + "+Palette", StringComparison.Ordinal)) formShown = (Form.ActiveForm.Location == designer.PointToScreen(new Point(activatedBounds.Left, activatedBounds.Bottom))); //work around: This is in order to show the smarttag activated when the drop down is shown but cursor leaves the active area of glyph if (!activated) { if (this.activeDesigner != null) { activated = true; } else if (Form.ActiveForm != null && Form.ActiveForm.GetType().FullName.Equals(typeof(ItemPalette).FullName + "+Palette", StringComparison.Ordinal)) { activated = formShown; } } graphics.FillRectangle(WorkflowTheme.CurrentTheme.AmbientTheme.BackgroundBrush, activatedBounds); using (Brush transparentSelectionBrush = new SolidBrush(Color.FromArgb(50, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor))) graphics.FillRectangle(transparentSelectionBrush, activatedBounds); graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds); //Draw the image Image image = designer.Image; image = (designer.Image == null) ? SmartTag.defaultImage : image; Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize; Size imageSize = designer.SmartTagRectangle.Size; Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Rectangle imageRectangle = activatedBounds; imageRectangle.X += margin.Width / 2; imageRectangle.Y += margin.Height / 2; imageRectangle.Size = imageSize; ActivityDesignerPaint.DrawImage(graphics, image, imageRectangle, DesignerContentAlignment.Center); //Draw the drop down indicator Rectangle dropDownRectangle = activatedBounds; dropDownRectangle.X += imageSize.Width + 3 * margin.Width / 2; dropDownRectangle.Y += margin.Height / 2; dropDownRectangle.Width = glyphSize.Width / 2; dropDownRectangle.Height -= glyphSize.Height / 4; using (GraphicsPath graphicsPath = ActivityDesignerPaint.GetScrollIndicatorPath(dropDownRectangle, ScrollButton.Down)) { graphics.FillPath(Brushes.Black, graphicsPath); graphics.DrawPath(Pens.Black, graphicsPath); } }
public override void OnLayoutSize(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme, Size containerSize) { base.OnLayoutSize(graphics, designerTheme, ambientTheme, containerSize); CompositeDesignerTheme compositeDesignerTheme = designerTheme as CompositeDesignerTheme; string text = this.ActivityDesigner.Text; Size size = Size.Empty; if (compositeDesignerTheme != null && !String.IsNullOrEmpty(text)) { size = StateMachineDesignerPaint.MeasureString(graphics, compositeDesignerTheme.Font, text, StringAlignment.Center, Size.Empty); } this.MinimumSize = size; this.Size = size; }
protected override bool OnPaintWorkflowAdornments(PaintEventArgs e, Rectangle viewPort, AmbientTheme ambientTheme) { if (this.dragImage != null) { ActivityDesignerPaint.DrawImage(e.Graphics, this.dragImage, new Rectangle(this.dragImagePointInClientCoOrd, this.dragImage.Size), new Rectangle(0, 0, this.dragImage.Width, this.dragImage.Height), DesignerContentAlignment.Center, (this.dragImageSnapped) ? 1.0f : 0.5f, WorkflowTheme.CurrentTheme.AmbientTheme.DrawGrayscale); } return(false); }
public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme) { string text = this.ActivityDesigner.Text; if (String.IsNullOrEmpty(text)) return; Font font = designerTheme.Font; ActivityDesignerPaint.DrawText(graphics, font, text, this.Bounds, StringAlignment.Near, ambientTheme.TextQuality, designerTheme.ForegroundBrush); }