Пример #1
0
        internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
        {
            //Draw all the activity designers contained by the activity designer
            //We know that all the children which are in drawing range will be always
            //consecutive both for parallel and for sequential containers hence
            //once we go in the invisible range we bail out of drawing logic for rest of
            //the children
            bool bDrawingVisibleChildren = false;

            foreach (ActivityDesigner activityDesigner in ContainedDesigners)
            {
                Rectangle designerBounds = activityDesigner.Bounds;
                if (e.ViewPort.IntersectsWith(designerBounds))
                {
                    bDrawingVisibleChildren = true;
                    using (PaintEventArgs paintEventArgs = new PaintEventArgs(e.Graphics, e.ViewPort))
                    {
                        ((IWorkflowDesignerMessageSink)activityDesigner).OnPaint(paintEventArgs, e.ViewPort);
                    }
                }
                else
                {
                    if (bDrawingVisibleChildren)
                    {
                        break;
                    }
                }
            }
        }
        public void OnPaint(ActivityDesignerPaintEventArgs e, bool drawSelected, bool drawPrimarySelection)
        {
            List <Point> list  = new List <Point>();
            List <Point> list2 = new List <Point>();

            for (int i = 0; i < this.editPoints.Count; i++)
            {
                EditPoint point = this.editPoints[i];
                if ((point.Type == EditPoint.EditPointTypes.ConnectionEditPoint) || (point.Type == EditPoint.EditPointTypes.MultiSegmentEditPoint))
                {
                    list.Add(point.Location);
                }
                else
                {
                    list2.Add(point.Location);
                }
            }
            if (drawSelected)
            {
                this.editedConnector.OnPaintSelected(e, drawPrimarySelection, list2.ToArray());
            }
            if (this.activeEditPoint != null)
            {
                this.editedConnector.OnPaintEdited(e, list.ToArray(), list2.ToArray());
            }
        }
Пример #3
0
 public static void PaintDesigner(ActivityDesigner activityDesigner, ActivityDesignerPaintEventArgs eventArgs)
 {
     if (activityDesigner == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("activityDesigner");
     }
     if (eventArgs == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("eventArgs");
     }
     ActivityDesigner parentDesigner = activityDesigner.ParentDesigner;
     if (parentDesigner == null)
     {
         // This designer is no more on the design surface , dont paint this.
         return;
     }
     if (!IsBranchVisible(activityDesigner))
     {
         return;
     }
     // special case designers contained inside activity preview designers ( only one of the contained designers is shown)
     bool visible = false;
     if (IsInsidePreviewDesignerBranch(activityDesigner, out visible))
     {
         if (visible)
         {
             PaintDesignerInternal(activityDesigner, eventArgs);
         }
     }
     else
     {
         PaintDesignerInternal(activityDesigner, eventArgs);
     }
 }
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     if ((this.Expanded && (this.ContainedDesigners.Count != 0)) && (this == base.ActiveView.AssociatedDesigner))
     {
         CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
         if (designerTheme != null)
         {
             Rectangle bounds = base.Bounds;
             Rectangle imageRectangle = this.ImageRectangle;
             Rectangle empty = Rectangle.Empty;
             empty.Width = (designerTheme.ConnectorSize.Height - (2 * e.AmbientTheme.Margin.Height)) + 2;
             empty.Height = empty.Width;
             empty.X = (bounds.Left + (bounds.Width / 2)) - (empty.Width / 2);
             empty.Y = ((bounds.Top + this.TitleHeight) + ((((designerTheme.ConnectorSize.Height * 3) / 2) - empty.Height) / 2)) + 1;
             using (GraphicsPath path = this.GetDiamondPath(empty))
             {
                 e.Graphics.FillPath(designerTheme.ForegroundBrush, path);
                 e.Graphics.DrawPath(designerTheme.ForegroundPen, path);
             }
             empty.Y = ((bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 2)) + ((((designerTheme.ConnectorSize.Height * 3) / 2) - empty.Height) / 2)) + 1;
             using (GraphicsPath path2 = this.GetDiamondPath(empty))
             {
                 e.Graphics.FillPath(designerTheme.ForegroundBrush, path2);
                 e.Graphics.DrawPath(designerTheme.ForegroundPen, path2);
             }
         }
     }
 }
Пример #5
0
        private void DrawParallelConnectors(ActivityDesignerPaintEventArgs e)
        {
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                Rectangle bounds = base.Bounds;
                int       num    = bounds.Top + this.TitleHeight;
                ReadOnlyCollection <ActivityDesigner> containedDesigners = this.ContainedDesigners;
                ReadOnlyCollection <Point>            connections        = containedDesigners[0].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
                ReadOnlyCollection <Point>            onlys3             = containedDesigners[containedDesigners.Count - 1].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
                Point[] points = new Point[2];
                points[0].X = bounds.Left + (bounds.Width / 2);
                points[0].Y = num;
                points[1].X = bounds.Left + (bounds.Width / 2);
                points[1].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
                base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
                Point point = connections[0];
                points[0].X = point.X;
                points[0].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
                Point point2 = onlys3[0];
                points[1].X = point2.X;
                points[1].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
                base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
                Point point3 = connections[connections.Count - 1];
                points[0].X = point3.X;
                points[0].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
                Point point4 = onlys3[onlys3.Count - 1];
                points[1].X = point4.X;
                points[1].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
                base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
                points[0].X = bounds.Left + (bounds.Width / 2);
                points[0].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
                points[1].X = bounds.Left + (bounds.Width / 2);
                points[1].Y = bounds.Bottom;
                base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
                foreach (ActivityDesigner designer3 in containedDesigners)
                {
                    ReadOnlyCollection <Point> onlys4 = designer3.GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
                    int     count       = onlys4.Count;
                    Point[] pointArray2 = new Point[2];
                    Point   point5      = onlys4[0];
                    pointArray2[0].X = point5.X;
                    pointArray2[0].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
                    Point point6 = onlys4[0];
                    pointArray2[1].X = point6.X;
                    Point point7 = onlys4[0];
                    pointArray2[1].Y = point7.Y;
                    base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
                    Point point8 = onlys4[count - 1];
                    pointArray2[0].X = point8.X;
                    Point point9 = onlys4[count - 1];
                    pointArray2[0].Y = point9.Y;
                    Point point10 = onlys4[count - 1];
                    pointArray2[1].X = point10.X;
                    pointArray2[1].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
                    base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
                }
            }
        }
        protected internal virtual void OnPaintEdited(ActivityDesignerPaintEventArgs e, Point[] segments, Point[] segmentEditPoints)
        {
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                using (Pen pen = new Pen(e.AmbientTheme.SelectionForegroundPen.Color, e.AmbientTheme.SelectionForegroundPen.Width))
                {
                    pen.DashStyle = DashStyle.Dash;
                    Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
                    Size connectorSize    = designerTheme.ConnectorSize;
                    ActivityDesignerPaint.DrawConnectors(e.Graphics, pen, segments, connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
                }
                if (this.source != null)
                {
                    this.source.OnPaint(e, false);
                }
                for (int i = 1; i < (segments.Length - 1); i++)
                {
                    this.PaintEditPoints(e, segments[i], false);
                }
                for (int j = 0; j < segmentEditPoints.Length; j++)
                {
                    this.PaintEditPoints(e, segmentEditPoints[j], true);
                }
                if (this.target != null)
                {
                    this.target.OnPaint(e, false);
                }
            }
        }
 protected override void OnPaintEdited(ActivityDesignerPaintEventArgs e, Point[] segments, Point[] segmentEditPoints)
 {
     if (((this.RootStateDesigner == null) || (this.RootStateDesigner.ActiveDesigner == null)) && (e.DesignerTheme is StateMachineTheme))
     {
         using (Pen pen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1f))
         {
             pen.DashStyle = DashStyle.Dash;
             e.Graphics.DrawLines(pen, segments);
             if (base.Source != null)
             {
                 base.Source.OnPaint(e, false);
             }
             for (int i = 1; i < (segments.Length - 1); i++)
             {
                 this.PaintEditPoints(e, segments[i], false);
             }
             for (int j = 0; j < segmentEditPoints.Length; j++)
             {
                 this.PaintEditPoints(e, segmentEditPoints[j], true);
             }
             if (base.Target != null)
             {
                 base.Target.OnPaint(e, false);
             }
         }
     }
 }
Пример #8
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (this.Expanded && (designerTheme != null))
            {
                Rectangle helpTextRectangle = this.HelpTextRectangle;
                if ((this.CurrentDropTarget == -1) && !helpTextRectangle.Size.IsEmpty)
                {
                    Rectangle[] connectors = this.GetConnectors();
                    if (connectors.Length > 0)
                    {
                        Point[] points = new Point[] { new Point(connectors[0].X + (connectors[0].Width / 2), connectors[0].Y + 2), new Point(connectors[0].X + (connectors[0].Width / 2), helpTextRectangle.Top - 2) };
                        base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, designerTheme.ConnectorStartCap, LineAnchor.None);
                        Point[] pointArray2 = new Point[] { new Point(connectors[0].X + (connectors[0].Width / 2), helpTextRectangle.Bottom + 2), new Point(connectors[0].X + (connectors[0].Width / 2), connectors[0].Bottom - 2) };
                        base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, LineAnchor.None, designerTheme.ConnectorEndCap);
                    }
                    ActivityDesignerPaint.DrawText(e.Graphics, designerTheme.Font, this.HelpText, helpTextRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, designerTheme.ForegroundBrush);
                }
                else
                {
                    Rectangle[] rectangleArray2 = this.GetConnectors();
                    for (int i = 0; i < rectangleArray2.Length; i++)
                    {
                        Pen        pen         = (i == this.CurrentDropTarget) ? e.AmbientTheme.DropIndicatorPen : designerTheme.ForegroundPen;
                        LineAnchor startCap    = (((i == 0) && (rectangleArray2.Length > 2)) || (i == (rectangleArray2.Length - 1))) ? LineAnchor.None : designerTheme.ConnectorStartCap;
                        LineAnchor endCap      = ((i == 0) || ((i == (rectangleArray2.Length - 1)) && (rectangleArray2.Length > 2))) ? LineAnchor.None : designerTheme.ConnectorEndCap;
                        Point[]    pointArray3 = new Point[] { new Point(rectangleArray2[i].Left + (rectangleArray2[i].Width / 2), rectangleArray2[i].Top + 2), new Point(rectangleArray2[i].Left + (rectangleArray2[i].Width / 2), rectangleArray2[i].Bottom - 2) };
                        base.DrawConnectors(e.Graphics, pen, pointArray3, startCap, endCap);
                    }
                }
            }
        }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
                return;

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
            Debug.Assert(compositeDesignerTheme != null);
            if (compositeDesignerTheme == null)
                return;

            //Draw the Icon and Text
            Rectangle bounds = Bounds;
            Rectangle imageRectangle = ImageRectangle;

            Rectangle roundRectangle = Rectangle.Empty;
            roundRectangle.Width = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height - 1;
            roundRectangle.Height = roundRectangle.Width;
            roundRectangle.X = bounds.Left + bounds.Width / 2 - roundRectangle.Width / 2;
            roundRectangle.Y = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;

            e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
            e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);

            roundRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;
            e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
            e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);
        }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (compositeDesignerTheme == null)
            {
                return;
            }

            //Draw the watermark at right bottom
            Rectangle watermarkRectangle = Rectangle.Empty;

            if (compositeDesignerTheme.WatermarkImage != null)
            {
                Rectangle bounds = Bounds;
                bounds.Inflate(-e.AmbientTheme.Margin.Width, -e.AmbientTheme.Margin.Height);
                watermarkRectangle = ActivityDesignerPaint.GetRectangleFromAlignment(compositeDesignerTheme.WatermarkAlignment, bounds, compositeDesignerTheme.WatermarkImage.Size);
            }

            //Here we go, draw header and footer rectangles
            if (Header != null)
            {
                Header.OnPaint(e);
            }

            if (Footer != null)
            {
                Footer.OnPaint(e);
            }
        }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
                return;

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
            Debug.Assert(compositeDesignerTheme != null);
            if (compositeDesignerTheme == null)
                return;

            //Draw the Icon and Text
            Rectangle bounds = Bounds;
            Rectangle imageRectangle = ImageRectangle;

            Rectangle diamondRectangle = Rectangle.Empty;
            diamondRectangle.Width = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height + 2;
            diamondRectangle.Height = diamondRectangle.Width;
            diamondRectangle.X = bounds.Left + bounds.Width / 2 - diamondRectangle.Width / 2;
            diamondRectangle.Y = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;

            using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
            {
                e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
                e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
            }

            diamondRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;
            using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
            {
                e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
                e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
            }
        }
Пример #12
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            //This is a problem, we need to improve the protocol between the preview window and the designer
            //The reason for this to be done is that the base's draw draws the preview designer and preview window
            //also draws the preview designer. The result is draw is called multiple times which slows down the designer.
            //We have to either bring the functionality of base class's draw here and not call base's draw or change the
            //designer inheritance hierarchy
            if (ShowPreview && !this.previewWindow.PreviewMode && PreviewedDesigner != null)
            {
                this.removePreviewedDesigner = true;
            }

            base.OnPaint(e);

            if (ShowPreview && !this.previewWindow.PreviewMode && PreviewedDesigner != null)
            {
                this.removePreviewedDesigner = false;
            }

            if (!Expanded || ActiveDesigner != this)
            {
                return;
            }

            this.previewStrip.Draw(e.Graphics);

            //Draw the separator between the strip and canvas
            //Draw the canvas and the strip
            if (ShowPreview)
            {
                e.Graphics.DrawLine(e.DesignerTheme.ForegroundPen, this.separatorLine[0], this.separatorLine[1]);
                this.previewWindow.Draw(e.Graphics, e.ViewPort);
            }
        }
Пример #13
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (Expanded && compositeDesignerTheme != null)
            {
                //Draw the connectors
                Rectangle helpTextRectangle = HelpTextRectangle;
                if (CurrentDropTarget == -1 && !helpTextRectangle.Size.IsEmpty)
                {
                    Rectangle[] connectors = GetConnectors();
                    if (connectors.Length > 0)
                    {
                        DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { new Point(connectors[0].X + connectors[0].Width / 2, connectors[0].Y + 2), new Point(connectors[0].X + connectors[0].Width / 2, helpTextRectangle.Top - 2) }, compositeDesignerTheme.ConnectorStartCap, LineAnchor.None);
                        DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { new Point(connectors[0].X + connectors[0].Width / 2, helpTextRectangle.Bottom + 2), new Point(connectors[0].X + connectors[0].Width / 2, connectors[0].Bottom - 2) }, LineAnchor.None, compositeDesignerTheme.ConnectorEndCap);
                    }

                    ActivityDesignerPaint.DrawText(e.Graphics, compositeDesignerTheme.Font, this.HelpText, helpTextRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, compositeDesignerTheme.ForegroundBrush);
                }
                else
                {
                    Rectangle[] connectors = GetConnectors();
                    for (int i = 0; i < connectors.Length; i++)
                    {
                        Pen        pen      = (i == CurrentDropTarget) ? e.AmbientTheme.DropIndicatorPen : compositeDesignerTheme.ForegroundPen;
                        LineAnchor startCap = ((i == 0 && connectors.Length > 2) || i == connectors.Length - 1) ? LineAnchor.None : compositeDesignerTheme.ConnectorStartCap;
                        LineAnchor endCap   = (i == 0 || (i == connectors.Length - 1 && connectors.Length > 2)) ? LineAnchor.None : compositeDesignerTheme.ConnectorEndCap;
                        DrawConnectors(e.Graphics, pen, new Point[] { new Point(connectors[i].Left + connectors[i].Width / 2, connectors[i].Top + 2), new Point(connectors[i].Left + connectors[i].Width / 2, connectors[i].Bottom - 2) }, startCap, endCap);
                    }
                }
            }
        }
        protected internal virtual void OnPaintSelected(ActivityDesignerPaintEventArgs e, bool primarySelection, Point[] segmentEditPoints)
        {
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                using (Pen pen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1f))
                {
                    Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
                    Size connectorSize    = designerTheme.ConnectorSize;
                    ActivityDesignerPaint.DrawConnectors(e.Graphics, pen, new List <Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
                }
                if (this.source != null)
                {
                    this.source.OnPaint(e, false);
                }
                ReadOnlyCollection <Point> connectorSegments = this.ConnectorSegments;
                for (int i = 1; i < (connectorSegments.Count - 1); i++)
                {
                    this.PaintEditPoints(e, connectorSegments[i], false);
                }
                for (int j = 0; j < segmentEditPoints.Length; j++)
                {
                    this.PaintEditPoints(e, segmentEditPoints[j], true);
                }
                if (this.target != null)
                {
                    this.target.OnPaint(e, false);
                }
            }
        }
 private void DrawParallelConnectors(ActivityDesignerPaintEventArgs e)
 {
     CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
     if (designerTheme != null)
     {
         Rectangle bounds = base.Bounds;
         int num = bounds.Top + this.TitleHeight;
         ReadOnlyCollection<ActivityDesigner> containedDesigners = this.ContainedDesigners;
         ReadOnlyCollection<Point> connections = containedDesigners[0].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
         ReadOnlyCollection<Point> onlys3 = containedDesigners[containedDesigners.Count - 1].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
         Point[] points = new Point[2];
         points[0].X = bounds.Left + (bounds.Width / 2);
         points[0].Y = num;
         points[1].X = bounds.Left + (bounds.Width / 2);
         points[1].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
         base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
         Point point = connections[0];
         points[0].X = point.X;
         points[0].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
         Point point2 = onlys3[0];
         points[1].X = point2.X;
         points[1].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
         base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
         Point point3 = connections[connections.Count - 1];
         points[0].X = point3.X;
         points[0].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
         Point point4 = onlys3[onlys3.Count - 1];
         points[1].X = point4.X;
         points[1].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
         base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
         points[0].X = bounds.Left + (bounds.Width / 2);
         points[0].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
         points[1].X = bounds.Left + (bounds.Width / 2);
         points[1].Y = bounds.Bottom;
         base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.None);
         foreach (ActivityDesigner designer3 in containedDesigners)
         {
             ReadOnlyCollection<Point> onlys4 = designer3.GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
             int count = onlys4.Count;
             Point[] pointArray2 = new Point[2];
             Point point5 = onlys4[0];
             pointArray2[0].X = point5.X;
             pointArray2[0].Y = num + ((designerTheme.ConnectorSize.Height * 3) / 4);
             Point point6 = onlys4[0];
             pointArray2[1].X = point6.X;
             Point point7 = onlys4[0];
             pointArray2[1].Y = point7.Y;
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
             Point point8 = onlys4[count - 1];
             pointArray2[0].X = point8.X;
             Point point9 = onlys4[count - 1];
             pointArray2[0].Y = point9.Y;
             Point point10 = onlys4[count - 1];
             pointArray2[1].X = point10.X;
             pointArray2[1].Y = bounds.Bottom - ((designerTheme.ConnectorSize.Height * 3) / 4);
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
         }
     }
 }
Пример #16
0
 internal static void Draw(ActivityDesignerPaintEventArgs e, Rectangle bounds)
 {
     bounds.Inflate(-1, -1);
     e.Graphics.FillEllipse(Brushes.White, bounds);
     e.Graphics.DrawEllipse(e.AmbientTheme.SelectionForegroundPen, bounds);
     bounds.Inflate(-1, -1);
     e.Graphics.FillEllipse(e.AmbientTheme.SelectionForegroundBrush, bounds);
 }
 internal static void Draw(ActivityDesignerPaintEventArgs e, Rectangle bounds)
 {
     bounds.Inflate(-1, -1);
     e.Graphics.FillEllipse(Brushes.White, bounds);
     e.Graphics.DrawEllipse(e.AmbientTheme.SelectionForegroundPen, bounds);
     bounds.Inflate(-1, -1);
     e.Graphics.FillEllipse(e.AmbientTheme.SelectionForegroundBrush, bounds);
 }
 internal void DrawDesignerGlyphs(ActivityDesignerPaintEventArgs e, ActivityDesigner designer)
 {
     foreach (DesignerGlyph glyph in this.GetDesignerGlyphs(designer))
     {
         glyph.Draw(e.Graphics, designer);
     }
     if ((this.activeGlyph != null) && (designer == this.activeDesigner))
     {
         this.activeGlyph.DrawActivated(e.Graphics, this.activeDesigner);
     }
 }
        protected internal virtual void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
                Size connectorSize    = designerTheme.ConnectorSize;
                ActivityDesignerPaint.DrawConnectors(e.Graphics, e.DesignerTheme.ForegroundPen, new List <Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
            }
        }
Пример #20
0
 private void DrawParallelDropTargets(ActivityDesignerPaintEventArgs e, int index)
 {
     Rectangle[] dropTargets = this.GetDropTargets(Point.Empty);
     if ((index >= 0) && (index < dropTargets.Length))
     {
         CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
         if (designerTheme != null)
         {
             ReadOnlyCollection <ActivityDesigner> containedDesigners = this.ContainedDesigners;
             Rectangle rectangle = dropTargets[index];
             Rectangle bounds    = base.Bounds;
             int       num       = bounds.Top + this.TitleHeight;
             num += (containedDesigners.Count > 0) ? ((designerTheme.ConnectorSize.Height * 3) / 4) : 0;
             int num2 = rectangle.Y - num;
             num2             += bounds.Bottom - rectangle.Bottom;
             num2             -= (containedDesigners.Count > 0) ? ((designerTheme.ConnectorSize.Height * 3) / 4) : 0;
             rectangle.Y       = num;
             rectangle.Height += num2;
             Point[] points = new Point[] { new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Top + 2), new Point(rectangle.Left + (rectangle.Width / 2), rectangle.Bottom - 2) };
             base.DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, points, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
             if (containedDesigners.Count > 0)
             {
                 if (index == 0)
                 {
                     ReadOnlyCollection <Point> connections = containedDesigners[0].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
                     Point[] pointArray = new Point[2];
                     pointArray[0].X = rectangle.X + (rectangle.Width / 2);
                     pointArray[0].Y = rectangle.Y;
                     Point point = connections[0];
                     pointArray[1].X = point.X;
                     pointArray[1].Y = rectangle.Y;
                     base.DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, pointArray, LineAnchor.None, LineAnchor.None);
                     pointArray[0].Y = rectangle.Bottom;
                     pointArray[1].Y = rectangle.Bottom;
                     base.DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, pointArray, LineAnchor.None, LineAnchor.None);
                 }
                 else if (index == containedDesigners.Count)
                 {
                     ReadOnlyCollection <Point> onlys3 = containedDesigners[containedDesigners.Count - 1].GetConnections(DesignerEdges.Bottom | DesignerEdges.Top);
                     Point[] pointArray2 = new Point[2];
                     Point   point2      = onlys3[0];
                     pointArray2[0].X = point2.X;
                     pointArray2[0].Y = rectangle.Y;
                     pointArray2[1].X = rectangle.X + (rectangle.Width / 2);
                     pointArray2[1].Y = rectangle.Y;
                     base.DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, pointArray2, LineAnchor.None, LineAnchor.None);
                     pointArray2[0].Y = rectangle.Bottom;
                     pointArray2[1].Y = rectangle.Bottom;
                     base.DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, pointArray2, LineAnchor.None, LineAnchor.None);
                 }
             }
         }
     }
 }
 internal void DrawDesignerGlyphs(ActivityDesignerPaintEventArgs e, ActivityDesigner designer)
 {
     foreach (DesignerGlyph glyph in this.GetDesignerGlyphs(designer))
     {
         glyph.Draw(e.Graphics, designer);
     }
     if ((this.activeGlyph != null) && (designer == this.activeDesigner))
     {
         this.activeGlyph.DrawActivated(e.Graphics, this.activeDesigner);
     }
 }
 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 void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if ((this.RootStateDesigner == null) || (this.RootStateDesigner.ActiveDesigner == null))
     {
         StateMachineTheme designerTheme = e.DesignerTheme as StateMachineTheme;
         if (designerTheme != null)
         {
             Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
             Size connectorSize = designerTheme.ConnectorSize;
             StateMachineDesignerPaint.DrawConnector(e.Graphics, designerTheme.ConnectorPen, new List<Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
         }
     }
 }
 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);
     }
 }
Пример #25
0
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     if (this.Expanded && (base.ActiveDesigner == this))
     {
         if (this.ContainedDesigners.Count > 0)
         {
             this.DrawParallelConnectors(e);
         }
         if (this.CurrentDropTarget >= 0)
         {
             this.DrawParallelDropTargets(e, this.CurrentDropTarget);
         }
     }
 }
Пример #26
0
            public override void OnPaint(ActivityDesignerPaintEventArgs e)
            {
                if (e == null)
                {
                    throw new ArgumentNullException("e");
                }
                Rectangle headerBarRectangle = this.HeaderBarRectangle;
                Color     empty  = Color.Empty;
                Color     color2 = Color.FromArgb(50, e.DesignerTheme.BorderColor);

                using (Brush brush = new LinearGradientBrush(headerBarRectangle, empty, color2, LinearGradientMode.Vertical))
                {
                    e.Graphics.FillRectangle(brush, headerBarRectangle);
                    e.Graphics.DrawLine(e.DesignerTheme.BorderPen, headerBarRectangle.Left, headerBarRectangle.Bottom, headerBarRectangle.Right, headerBarRectangle.Bottom);
                }
                base.OnPaint(e);
            }
Пример #27
0
        /// <summary>
        ///	We override the OnPaint method to draw an arrow that indicates that the execution
        /// flows back to the beginning of this activity after one iteration is completed.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            // We begin with drawing the base sequntial activity shape.
            base.OnPaint(e);

            // We we draw the looping arrow.
            if (Expanded)
            {
                CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
                if (compositeDesignerTheme == null)
                    return;

                Rectangle bounds = Bounds;
                Rectangle textRectangle = TextRectangle;
                Rectangle imageRectangle = ImageRectangle;

                // First figure out where the upper looping arrow should end.  That's the point where the icon 
                // image of the ForEach is inside the Bounds.
                Point connectionPoint = Point.Empty;
                if (!imageRectangle.IsEmpty)
                    connectionPoint = new Point(imageRectangle.Left - e.AmbientTheme.Margin.Width / 2, imageRectangle.Top + imageRectangle.Height / 2);
                else if (!textRectangle.IsEmpty)
                    connectionPoint = new Point(textRectangle.Left - e.AmbientTheme.Margin.Width / 2, textRectangle.Top + textRectangle.Height / 2);
                else
                    connectionPoint = new Point((bounds.Left + bounds.Width / 2) - e.AmbientTheme.Margin.Width / 2, bounds.Top + e.AmbientTheme.Margin.Height / 2);

                // Now contruct the 4 points where we would draw the looping arrow.  It starts at the lower-central line,
                // going to the lower right then up to upper right and finishes at the upper-central point.
                Point[] points = new Point[4];
                points[0].X = bounds.Left + bounds.Width / 2;
                points[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[1].X = bounds.Left + compositeDesignerTheme.ConnectorSize.Width / 3;
                points[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[2].X = bounds.Left + compositeDesignerTheme.ConnectorSize.Width / 3;
                points[2].Y = connectionPoint.Y;
                points[3].X = connectionPoint.X;
                points[3].Y = connectionPoint.Y;

                // Draw the loop.
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
                // Draw the last section of the downward arrow that connections the beginning of 
                // the looping arrow to the bottom of the activity shape.
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { points[0], new Point(bounds.Left + bounds.Width / 2, bounds.Bottom) }, LineAnchor.None, LineAnchor.None);
            }
        }
Пример #28
0
 public virtual void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if ((!string.IsNullOrEmpty(this.Text) && !this.TextRectangle.Size.IsEmpty) && ((e.DesignerTheme != null) && (e.DesignerTheme.Font != null)))
     {
         using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1f, this.AssociatedDesigner.SmartTagVisible ? FontStyle.Bold : FontStyle.Regular))
         {
             ActivityDesignerPaint.DrawText(e.Graphics, font, this.Text, this.TextRectangle, StringAlignment.Center, TextQuality.AntiAliased, e.DesignerTheme.ForegroundBrush);
         }
     }
     if ((this.Image != null) && !this.ImageRectangle.Size.IsEmpty)
     {
         ActivityDesignerPaint.DrawImage(e.Graphics, this.Image, this.ImageRectangle, DesignerContentAlignment.Fill);
     }
 }
 public virtual void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     if ((!string.IsNullOrEmpty(this.Text) && !this.TextRectangle.Size.IsEmpty) && ((e.DesignerTheme != null) && (e.DesignerTheme.Font != null)))
     {
         using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1f, this.AssociatedDesigner.SmartTagVisible ? FontStyle.Bold : FontStyle.Regular))
         {
             ActivityDesignerPaint.DrawText(e.Graphics, font, this.Text, this.TextRectangle, StringAlignment.Center, TextQuality.AntiAliased, e.DesignerTheme.ForegroundBrush);
         }
     }
     if ((this.Image != null) && !this.ImageRectangle.Size.IsEmpty)
     {
         ActivityDesignerPaint.DrawImage(e.Graphics, this.Image, this.ImageRectangle, DesignerContentAlignment.Fill);
     }
 }
Пример #30
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (Expanded && ActiveDesigner == this)
            {
                //Draw the connectors
                if (ContainedDesigners.Count > 0)
                {
                    DrawParallelConnectors(e);
                }

                //Drop targets to add the branches
                if (CurrentDropTarget >= 0)
                {
                    DrawParallelDropTargets(e, CurrentDropTarget);
                }
            }
        }
        /// <summary>
        /// Draws the Header/Footer associated with workflow root designer.
        /// </summary>
        /// <param name="e">ActivityDesignerPaintEventArgs holding drawing arguments</param>
        public virtual void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (!String.IsNullOrEmpty(Text) && !TextRectangle.Size.IsEmpty && e.DesignerTheme != null && e.DesignerTheme.Font != null)
            {
                //use bold or regular font based on mouse over status
                using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1.0f, (this.AssociatedDesigner.SmartTagVisible) ? FontStyle.Bold : FontStyle.Regular))
                    ActivityDesignerPaint.DrawText(e.Graphics, font, Text, TextRectangle, StringAlignment.Center, TextQuality.AntiAliased, e.DesignerTheme.ForegroundBrush);
            }

            if (Image != null && !ImageRectangle.Size.IsEmpty)
            {
                ActivityDesignerPaint.DrawImage(e.Graphics, Image, ImageRectangle, DesignerContentAlignment.Fill);
            }
        }
        internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
        {
            if (this.ShowConnectorsInForeground)
            {
                base.OnPaintContainedDesigners(e);
            }
            FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this);

            if (((connectorContainer != null) && (base.Activity != null)) && (base.Activity.Site != null))
            {
                Region region = null;
                Region clip   = e.Graphics.Clip;
                try
                {
                    if (clip != null)
                    {
                        region = new Region(connectorContainer.Bounds);
                        region.Intersect(e.ViewPort);
                        e.Graphics.Clip = region;
                    }
                    foreach (Connector connector in connectorContainer.Connectors)
                    {
                        if (this == connector.RenderingOwner)
                        {
                            connector.OnPaint(e);
                        }
                    }
                }
                finally
                {
                    if (clip != null)
                    {
                        e.Graphics.Clip = clip;
                        region.Dispose();
                    }
                }
            }
            if (!this.ShowConnectorsInForeground)
            {
                base.OnPaintContainedDesigners(e);
            }
        }
Пример #33
0
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if ((this.ShowPreview && !this.previewWindow.PreviewMode) && (this.PreviewedDesigner != null))
     {
         this.removePreviewedDesigner = true;
     }
     base.OnPaint(e);
     if ((this.ShowPreview && !this.previewWindow.PreviewMode) && (this.PreviewedDesigner != null))
     {
         this.removePreviewedDesigner = false;
     }
     if (this.Expanded && (base.ActiveDesigner == this))
     {
         this.previewStrip.Draw(e.Graphics);
         if (this.ShowPreview)
         {
             e.Graphics.DrawLine(e.DesignerTheme.ForegroundPen, this.separatorLine[0], this.separatorLine[1]);
             this.previewWindow.Draw(e.Graphics, e.ViewPort);
         }
     }
 }
            public override void OnPaint(ActivityDesignerPaintEventArgs e)
            {
                if (e == null)
                {
                    throw new ArgumentNullException("e");
                }

                Rectangle rectangle = FooterBarRectangle;

                if (!FooterBarRectangle.IsEmpty)
                {
                    Color color1 = Color.Empty;
                    Color color2 = Color.FromArgb(50, e.DesignerTheme.BorderColor);
                    using (Brush linearGradientBrush = new LinearGradientBrush(rectangle, color2, color1, LinearGradientMode.Vertical))
                    {
                        e.Graphics.FillRectangle(linearGradientBrush, rectangle);
                        e.Graphics.DrawLine(e.DesignerTheme.BorderPen, rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Top);
                    }
                }

                base.OnPaint(e);
            }
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
     if (designerTheme != null)
     {
         if (designerTheme.WatermarkImage != null)
         {
             Rectangle bounds = base.Bounds;
             bounds.Inflate(-e.AmbientTheme.Margin.Width, -e.AmbientTheme.Margin.Height);
             ActivityDesignerPaint.GetRectangleFromAlignment(designerTheme.WatermarkAlignment, bounds, designerTheme.WatermarkImage.Size);
         }
         if (this.Header != null)
         {
             this.Header.OnPaint(e);
         }
         if (this.Footer != null)
         {
             this.Footer.OnPaint(e);
         }
     }
 }
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     if (this.Expanded)
     {
         CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
         if (designerTheme != null)
         {
             Rectangle bounds = base.Bounds;
             Rectangle textRectangle = this.TextRectangle;
             Rectangle imageRectangle = this.ImageRectangle;
             Point empty = Point.Empty;
             if (!imageRectangle.IsEmpty)
             {
                 empty = new Point(imageRectangle.Right + (e.AmbientTheme.Margin.Width / 2), imageRectangle.Top + (imageRectangle.Height / 2));
             }
             else if (!textRectangle.IsEmpty)
             {
                 empty = new Point(textRectangle.Right + (e.AmbientTheme.Margin.Width / 2), textRectangle.Top + (textRectangle.Height / 2));
             }
             else
             {
                 empty = new Point((bounds.Left + (bounds.Width / 2)) + (e.AmbientTheme.Margin.Width / 2), bounds.Top + (e.AmbientTheme.Margin.Height / 2));
             }
             Point[] points = new Point[4];
             points[0].X = bounds.Left + (bounds.Width / 2);
             points[0].Y = bounds.Bottom - (designerTheme.ConnectorSize.Height / 3);
             points[1].X = bounds.Right - (designerTheme.ConnectorSize.Width / 3);
             points[1].Y = bounds.Bottom - (designerTheme.ConnectorSize.Height / 3);
             points[2].X = bounds.Right - (designerTheme.ConnectorSize.Width / 3);
             points[2].Y = empty.Y;
             points[3].X = empty.X;
             points[3].Y = empty.Y;
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
             Point[] pointArray2 = new Point[] { points[0], new Point(bounds.Left + (bounds.Width / 2), bounds.Bottom) };
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, LineAnchor.None, LineAnchor.None);
         }
     }
 }
        internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
        {
            bool flag = false;

            foreach (ActivityDesigner designer in this.ContainedDesigners)
            {
                Rectangle bounds = designer.Bounds;
                if (e.ViewPort.IntersectsWith(bounds))
                {
                    flag = true;
                    using (PaintEventArgs args = new PaintEventArgs(e.Graphics, e.ViewPort))
                    {
                        ((IWorkflowDesignerMessageSink)designer).OnPaint(args, e.ViewPort);
                        continue;
                    }
                }
                if (flag)
                {
                    break;
                }
            }
        }
Пример #38
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                if (designerTheme.WatermarkImage != null)
                {
                    Rectangle bounds = base.Bounds;
                    bounds.Inflate(-e.AmbientTheme.Margin.Width, -e.AmbientTheme.Margin.Height);
                    ActivityDesignerPaint.GetRectangleFromAlignment(designerTheme.WatermarkAlignment, bounds, designerTheme.WatermarkImage.Size);
                }
                if (this.Header != null)
                {
                    this.Header.OnPaint(e);
                }
                if (this.Footer != null)
                {
                    this.Footer.OnPaint(e);
                }
            }
        }
Пример #39
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (Expanded)
            {
                CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
                Debug.Assert(compositeDesignerTheme != null);
                if (compositeDesignerTheme == null)
                    return;

                Rectangle bounds = Bounds;
                Rectangle textRectangle = TextRectangle;
                Rectangle imageRectangle = ImageRectangle;

                Point connectionPoint = Point.Empty;
                if (!imageRectangle.IsEmpty)
                    connectionPoint = new Point(imageRectangle.Right + e.AmbientTheme.Margin.Width / 2, imageRectangle.Top + imageRectangle.Height / 2);
                else if (!textRectangle.IsEmpty)
                    connectionPoint = new Point(textRectangle.Right + e.AmbientTheme.Margin.Width / 2, textRectangle.Top + textRectangle.Height / 2);
                else
                    connectionPoint = new Point(bounds.Left + bounds.Width / 2 + e.AmbientTheme.Margin.Width / 2, bounds.Top + e.AmbientTheme.Margin.Height / 2);

                Point[] points = new Point[4];
                points[0].X = bounds.Left + bounds.Width / 2;
                points[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[1].X = bounds.Right - compositeDesignerTheme.ConnectorSize.Width / 3;
                points[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[2].X = bounds.Right - compositeDesignerTheme.ConnectorSize.Width / 3;
                points[2].Y = connectionPoint.Y;
                points[3].X = connectionPoint.X;
                points[3].Y = connectionPoint.Y;

                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { points[0], new Point(bounds.Left + bounds.Width / 2, bounds.Bottom) }, LineAnchor.None, LineAnchor.None);
            }
        }
        public static void PaintDesigner(ActivityDesigner activityDesigner, ActivityDesignerPaintEventArgs eventArgs)
        {
            if (activityDesigner == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("activityDesigner");
            }
            if (eventArgs == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("eventArgs");
            }
            ActivityDesigner parentDesigner = activityDesigner.ParentDesigner;

            if (parentDesigner == null)
            {
                // This designer is no more on the design surface , dont paint this.
                return;
            }
            if (!IsBranchVisible(activityDesigner))
            {
                return;
            }
            // special case designers contained inside activity preview designers ( only one of the contained designers is shown)
            bool visible = false;

            if (IsInsidePreviewDesignerBranch(activityDesigner, out visible))
            {
                if (visible)
                {
                    PaintDesignerInternal(activityDesigner, eventArgs);
                }
            }
            else
            {
                PaintDesignerInternal(activityDesigner, eventArgs);
            }
        }
        private void PaintEditPoints(ActivityDesignerPaintEventArgs e, Point point, bool drawMidSegmentEditPoint)
        {
            Size size = (this.source != null) ? this.source.Bounds.Size : Size.Empty;

            if (!size.IsEmpty)
            {
                Rectangle rect = new Rectangle(point.X - (size.Width / 2), point.Y - (size.Height / 2), size.Width, size.Height);
                if (drawMidSegmentEditPoint)
                {
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(new Point(rect.Left + (rect.Width / 2), rect.Top), new Point(rect.Right, rect.Top + (rect.Height / 2)));
                        path.AddLine(new Point(rect.Right, rect.Top + (rect.Height / 2)), new Point(rect.Left + (rect.Width / 2), rect.Bottom));
                        path.AddLine(new Point(rect.Left + (rect.Width / 2), rect.Bottom), new Point(rect.Left, rect.Top + (rect.Height / 2)));
                        path.AddLine(new Point(rect.Left, rect.Top + (rect.Height / 2)), new Point(rect.Left + (rect.Width / 2), rect.Top));
                        e.Graphics.FillPath(Brushes.White, path);
                        e.Graphics.DrawPath(e.AmbientTheme.SelectionForegroundPen, path);
                        return;
                    }
                }
                rect.Inflate(-1, -1);
                e.Graphics.FillEllipse(e.AmbientTheme.SelectionForegroundBrush, rect);
            }
        }
Пример #42
0
        private void DrawParallelConnectors(ActivityDesignerPaintEventArgs e)
        {
            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (compositeDesignerTheme == null)
            {
                return;
            }

            //Get all the information required to calculate the connectors
            Rectangle bounds = Bounds;
            int       parallelConnectorTop = bounds.Top;

            parallelConnectorTop += TitleHeight;

            ReadOnlyCollection <ActivityDesigner> containedDesigners = ContainedDesigners;

            ActivityDesigner           firstDesigner            = containedDesigners[0];
            ReadOnlyCollection <Point> firstDesignerConnections = firstDesigner.GetConnections(DesignerEdges.Top | DesignerEdges.Bottom);

            ActivityDesigner           lastDesigner            = containedDesigners[containedDesigners.Count - 1];
            ReadOnlyCollection <Point> lastDesignerConnections = lastDesigner.GetConnections(DesignerEdges.Top | DesignerEdges.Bottom);

            Point[] parallelLinks = new Point[2];

            //Draw small vertical line at the top
            parallelLinks[0].X = bounds.Left + bounds.Width / 2;
            parallelLinks[0].Y = parallelConnectorTop;
            parallelLinks[1].X = bounds.Left + bounds.Width / 2;
            parallelLinks[1].Y = parallelConnectorTop + compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, parallelLinks, LineAnchor.None, LineAnchor.None);

            //Draw Horizontal line at the top
            parallelLinks[0].X = firstDesignerConnections[0].X;
            parallelLinks[0].Y = parallelConnectorTop + compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            parallelLinks[1].X = lastDesignerConnections[0].X;
            parallelLinks[1].Y = parallelConnectorTop + compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, parallelLinks, LineAnchor.None, LineAnchor.None);

            //Draw Horizontal line at the bottom
            parallelLinks[0].X = firstDesignerConnections[firstDesignerConnections.Count - 1].X;
            parallelLinks[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            parallelLinks[1].X = lastDesignerConnections[lastDesignerConnections.Count - 1].X;
            parallelLinks[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, parallelLinks, LineAnchor.None, LineAnchor.None);

            //Draw small vertical line at the bottom
            parallelLinks[0].X = bounds.Left + bounds.Width / 2;
            parallelLinks[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
            parallelLinks[1].X = bounds.Left + bounds.Width / 2;
            parallelLinks[1].Y = bounds.Bottom;
            DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, parallelLinks, LineAnchor.None, LineAnchor.None);

            foreach (ActivityDesigner activityDesigner in containedDesigners)
            {
                ReadOnlyCollection <Point> designerConnections = activityDesigner.GetConnections(DesignerEdges.Top | DesignerEdges.Bottom);
                int     connectionCount = designerConnections.Count;
                Point[] connectingLine  = new Point[2];

                //Draw connectors for every activityDesigner
                connectingLine[0].X = designerConnections[0].X;
                connectingLine[0].Y = parallelConnectorTop + compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
                connectingLine[1].X = designerConnections[0].X;
                connectingLine[1].Y = designerConnections[0].Y;
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, connectingLine, compositeDesignerTheme.ConnectorStartCap, compositeDesignerTheme.ConnectorEndCap);

                //Draw connectors for every activityDesigner
                connectingLine[0].X = designerConnections[connectionCount - 1].X;
                connectingLine[0].Y = designerConnections[connectionCount - 1].Y;
                connectingLine[1].X = designerConnections[connectionCount - 1].X;
                connectingLine[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 4;
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, connectingLine, compositeDesignerTheme.ConnectorStartCap, compositeDesignerTheme.ConnectorEndCap);
            }
        }
Пример #43
0
        private void DrawParallelDropTargets(ActivityDesignerPaintEventArgs e, int index)
        {
            Rectangle[] dropTargets = GetDropTargets(Point.Empty);
            if (index < 0 || index >= dropTargets.Length)
            {
                return;
            }

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if (compositeDesignerTheme == null)
            {
                return;
            }

            ReadOnlyCollection <ActivityDesigner> containedDesigners = ContainedDesigners;
            Rectangle dropTargetRectangle = dropTargets[index];

            Rectangle bounds = Bounds;
            int       parallelConnectorTop = bounds.Top;

            parallelConnectorTop += TitleHeight;
            parallelConnectorTop += (containedDesigners.Count > 0) ? compositeDesignerTheme.ConnectorSize.Height * 3 / 4 : 0;

            int heightDelta = dropTargetRectangle.Y - parallelConnectorTop;

            heightDelta += bounds.Bottom - dropTargetRectangle.Bottom;
            heightDelta -= (containedDesigners.Count > 0) ? compositeDesignerTheme.ConnectorSize.Height * 3 / 4 : 0;

            dropTargetRectangle.Y       = parallelConnectorTop;
            dropTargetRectangle.Height += heightDelta;
            DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, new Point[] { new Point(dropTargetRectangle.Left + dropTargetRectangle.Width / 2, dropTargetRectangle.Top + 2), new Point(dropTargetRectangle.Left + dropTargetRectangle.Width / 2, dropTargetRectangle.Bottom - 2) }, compositeDesignerTheme.ConnectorStartCap, compositeDesignerTheme.ConnectorEndCap);

            if (containedDesigners.Count > 0)
            {
                if (index == 0)
                {
                    ActivityDesigner           firstDesigner            = containedDesigners[0];
                    ReadOnlyCollection <Point> firstDesignerConnections = firstDesigner.GetConnections(DesignerEdges.Top | DesignerEdges.Bottom);

                    Point[] connectorPoints = new Point[2];
                    connectorPoints[0].X = dropTargetRectangle.X + dropTargetRectangle.Width / 2;
                    connectorPoints[0].Y = dropTargetRectangle.Y;
                    connectorPoints[1].X = firstDesignerConnections[0].X;
                    connectorPoints[1].Y = dropTargetRectangle.Y;
                    DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, connectorPoints, LineAnchor.None, LineAnchor.None);

                    connectorPoints[0].Y = dropTargetRectangle.Bottom;
                    connectorPoints[1].Y = dropTargetRectangle.Bottom;
                    DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, connectorPoints, LineAnchor.None, LineAnchor.None);
                }
                else if (index == containedDesigners.Count)
                {
                    ActivityDesigner           lastDesigner            = containedDesigners[containedDesigners.Count - 1];
                    ReadOnlyCollection <Point> lastDesignerConnections = lastDesigner.GetConnections(DesignerEdges.Top | DesignerEdges.Bottom);

                    Point[] connectorPoints = new Point[2];
                    connectorPoints[0].X = lastDesignerConnections[0].X;
                    connectorPoints[0].Y = dropTargetRectangle.Y;
                    connectorPoints[1].X = dropTargetRectangle.X + dropTargetRectangle.Width / 2;
                    connectorPoints[1].Y = dropTargetRectangle.Y;
                    DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, connectorPoints, LineAnchor.None, LineAnchor.None);

                    connectorPoints[0].Y = dropTargetRectangle.Bottom;
                    connectorPoints[1].Y = dropTargetRectangle.Bottom;
                    DrawConnectors(e.Graphics, e.AmbientTheme.DropIndicatorPen, connectorPoints, LineAnchor.None, LineAnchor.None);
                }
            }
        }
 /// <summary>
 /// Call the OnPaint on the contained designers
 /// </summary>
 /// <param name="e">EventArgs to be used for painting</param>
 protected void PaintContainedDesigners(ActivityDesignerPaintEventArgs e)
 {
     OnPaintContainedDesigners(e);
 }
 internal virtual void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
 {
     foreach (ActivityDesigner activityDesigner in ContainedDesigners)
     {
         using (PaintEventArgs paintEventArgs = new PaintEventArgs(e.Graphics, e.ViewPort))
         {
             ((IWorkflowDesignerMessageSink)activityDesigner).OnPaint(paintEventArgs, e.ViewPort);
         }
     }
 }
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     string targetState = this.TargetState;
     ActivityDesignerPaint.DrawText(e.Graphics, e.DesignerTheme.Font, targetState, this.TargetStateRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, e.DesignerTheme.ForegroundBrush);
 }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
            if (compositeDesignerTheme == null)
                return;

            //Draw the expand collapse button and the connection
            if (CanExpandCollapse)
            {
                Rectangle expandButtonRectangle = ExpandButtonRectangle;
                if (!expandButtonRectangle.Size.IsEmpty)
                {
                    ActivityDesignerPaint.DrawExpandButton(e.Graphics, expandButtonRectangle, !Expanded, compositeDesignerTheme);
                }
            }

            if (Expanded)
                PaintContainedDesigners(e);
        }
Пример #48
0
 public void OnPaint(ActivityDesignerPaintEventArgs e, bool drawHighlighted)
 {
     Draw(e, this.Bounds);
 }
        /// <summary>
        /// Draws the Header/Footer associated with workflow root designer.
        /// </summary>
        /// <param name="e">ActivityDesignerPaintEventArgs holding drawing arguments</param>
        public virtual void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (!String.IsNullOrEmpty(Text) && !TextRectangle.Size.IsEmpty && e.DesignerTheme != null && e.DesignerTheme.Font != null)
            {
                //use bold or regular font based on mouse over status
                using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1.0f, (this.AssociatedDesigner.SmartTagVisible) ? FontStyle.Bold : FontStyle.Regular))
                    ActivityDesignerPaint.DrawText(e.Graphics, font, Text, TextRectangle, StringAlignment.Center, TextQuality.AntiAliased, e.DesignerTheme.ForegroundBrush);
            }

            if (Image != null && !ImageRectangle.Size.IsEmpty)
                ActivityDesignerPaint.DrawImage(e.Graphics, Image, ImageRectangle, DesignerContentAlignment.Fill);
        }
        internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
        {
            if (ShowConnectorsInForeground)
                base.OnPaintContainedDesigners(e);

            FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this);
            if (connectorContainer != null && Activity != null && Activity.Site != null)
            {
                Region clipRegion = null;
                Region oldClipRegion = e.Graphics.Clip;

                try
                {
                    if (oldClipRegion != null)
                    {
                        clipRegion = new Region(connectorContainer.Bounds);
                        clipRegion.Intersect(e.ViewPort);
                        e.Graphics.Clip = clipRegion;
                    }

                    //Lets draw all the connectors before the designers so that designers always overlap connectors
                    foreach (Connector connector in connectorContainer.Connectors)
                    {
                        if (this == connector.RenderingOwner)
                            connector.OnPaint(e);
                    }
                }
                finally
                {
                    if (oldClipRegion != null)
                    {
                        e.Graphics.Clip = oldClipRegion;
                        clipRegion.Dispose();
                    }
                }
            }

            if (!ShowConnectorsInForeground)
                base.OnPaintContainedDesigners(e);
        }
        private static void PaintDesignerInternal(ActivityDesigner activityDesigner, ActivityDesignerPaintEventArgs eventArgs)
        {
            IWorkflowDesignerMessageSink sink = (IWorkflowDesignerMessageSink)activityDesigner;

            sink.OnPaint(new PaintEventArgs(eventArgs.Graphics, eventArgs.ClipRectangle), eventArgs.ClipRectangle);
        }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
            if (Expanded && compositeDesignerTheme != null)
            {
                //Draw the connectors
                Rectangle helpTextRectangle = HelpTextRectangle;
                if (CurrentDropTarget == -1 && !helpTextRectangle.Size.IsEmpty)
                {
                    Rectangle[] connectors = GetConnectors();
                    if (connectors.Length > 0)
                    {
                        DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { new Point(connectors[0].X + connectors[0].Width / 2, connectors[0].Y + 2), new Point(connectors[0].X + connectors[0].Width / 2, helpTextRectangle.Top - 2) }, compositeDesignerTheme.ConnectorStartCap, LineAnchor.None);
                        DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { new Point(connectors[0].X + connectors[0].Width / 2, helpTextRectangle.Bottom + 2), new Point(connectors[0].X + connectors[0].Width / 2, connectors[0].Bottom - 2) }, LineAnchor.None, compositeDesignerTheme.ConnectorEndCap);
                    }

                    ActivityDesignerPaint.DrawText(e.Graphics, compositeDesignerTheme.Font, this.HelpText, helpTextRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, compositeDesignerTheme.ForegroundBrush);
                }
                else
                {
                    Rectangle[] connectors = GetConnectors();
                    for (int i = 0; i < connectors.Length; i++)
                    {
                        Pen pen = (i == CurrentDropTarget) ? e.AmbientTheme.DropIndicatorPen : compositeDesignerTheme.ForegroundPen;
                        LineAnchor startCap = ((i == 0 && connectors.Length > 2) || i == connectors.Length - 1) ? LineAnchor.None : compositeDesignerTheme.ConnectorStartCap;
                        LineAnchor endCap = (i == 0 || (i == connectors.Length - 1 && connectors.Length > 2)) ? LineAnchor.None : compositeDesignerTheme.ConnectorEndCap;
                        DrawConnectors(e.Graphics, pen, new Point[] { new Point(connectors[i].Left + connectors[i].Width / 2, connectors[i].Top + 2), new Point(connectors[i].Left + connectors[i].Width / 2, connectors[i].Bottom - 2) }, startCap, endCap);
                    }
                }
            }
        }
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
     if (this.Expanded && (designerTheme != null))
     {
         Rectangle helpTextRectangle = this.HelpTextRectangle;
         if ((this.CurrentDropTarget == -1) && !helpTextRectangle.Size.IsEmpty)
         {
             Rectangle[] connectors = this.GetConnectors();
             if (connectors.Length > 0)
             {
                 Point[] points = new Point[] { new Point(connectors[0].X + (connectors[0].Width / 2), connectors[0].Y + 2), new Point(connectors[0].X + (connectors[0].Width / 2), helpTextRectangle.Top - 2) };
                 base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, designerTheme.ConnectorStartCap, LineAnchor.None);
                 Point[] pointArray2 = new Point[] { new Point(connectors[0].X + (connectors[0].Width / 2), helpTextRectangle.Bottom + 2), new Point(connectors[0].X + (connectors[0].Width / 2), connectors[0].Bottom - 2) };
                 base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, LineAnchor.None, designerTheme.ConnectorEndCap);
             }
             ActivityDesignerPaint.DrawText(e.Graphics, designerTheme.Font, this.HelpText, helpTextRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, designerTheme.ForegroundBrush);
         }
         else
         {
             Rectangle[] rectangleArray2 = this.GetConnectors();
             for (int i = 0; i < rectangleArray2.Length; i++)
             {
                 Pen pen = (i == this.CurrentDropTarget) ? e.AmbientTheme.DropIndicatorPen : designerTheme.ForegroundPen;
                 LineAnchor startCap = (((i == 0) && (rectangleArray2.Length > 2)) || (i == (rectangleArray2.Length - 1))) ? LineAnchor.None : designerTheme.ConnectorStartCap;
                 LineAnchor endCap = ((i == 0) || ((i == (rectangleArray2.Length - 1)) && (rectangleArray2.Length > 2))) ? LineAnchor.None : designerTheme.ConnectorEndCap;
                 Point[] pointArray3 = new Point[] { new Point(rectangleArray2[i].Left + (rectangleArray2[i].Width / 2), rectangleArray2[i].Top + 2), new Point(rectangleArray2[i].Left + (rectangleArray2[i].Width / 2), rectangleArray2[i].Bottom - 2) };
                 base.DrawConnectors(e.Graphics, pen, pointArray3, startCap, endCap);
             }
         }
     }
 }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            //This is a problem, we need to improve the protocol between the preview window and the designer
            //The reason for this to be done is that the base's draw draws the preview designer and preview window
            //also draws the preview designer. The result is draw is called multiple times which slows down the designer.
            //We have to either bring the functionality of base class's draw here and not call base's draw or change the 
            //designer inheritance hierarchy
            if (ShowPreview && !this.previewWindow.PreviewMode && PreviewedDesigner != null)
                this.removePreviewedDesigner = true;

            base.OnPaint(e);

            if (ShowPreview && !this.previewWindow.PreviewMode && PreviewedDesigner != null)
                this.removePreviewedDesigner = false;

            if (!Expanded || ActiveDesigner != this)
                return;

            this.previewStrip.Draw(e.Graphics);

            //Draw the separator between the strip and canvas
            //Draw the canvas and the strip
            if (ShowPreview)
            {
                e.Graphics.DrawLine(e.DesignerTheme.ForegroundPen, this.separatorLine[0], this.separatorLine[1]);
                this.previewWindow.Draw(e.Graphics, e.ViewPort);
            }
        }
 internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
 {
     if (this.ShowConnectorsInForeground)
     {
         base.OnPaintContainedDesigners(e);
     }
     FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this);
     if (((connectorContainer != null) && (base.Activity != null)) && (base.Activity.Site != null))
     {
         Region region = null;
         Region clip = e.Graphics.Clip;
         try
         {
             if (clip != null)
             {
                 region = new Region(connectorContainer.Bounds);
                 region.Intersect(e.ViewPort);
                 e.Graphics.Clip = region;
             }
             foreach (Connector connector in connectorContainer.Connectors)
             {
                 if (this == connector.RenderingOwner)
                 {
                     connector.OnPaint(e);
                 }
             }
         }
         finally
         {
             if (clip != null)
             {
                 e.Graphics.Clip = clip;
                 region.Dispose();
             }
         }
     }
     if (!this.ShowConnectorsInForeground)
     {
         base.OnPaintContainedDesigners(e);
     }
 }
 public override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e");
     }
     Rectangle headerBarRectangle = this.HeaderBarRectangle;
     Color empty = Color.Empty;
     Color color2 = Color.FromArgb(50, e.DesignerTheme.BorderColor);
     using (Brush brush = new LinearGradientBrush(headerBarRectangle, empty, color2, LinearGradientMode.Vertical))
     {
         e.Graphics.FillRectangle(brush, headerBarRectangle);
         e.Graphics.DrawLine(e.DesignerTheme.BorderPen, headerBarRectangle.Left, headerBarRectangle.Bottom, headerBarRectangle.Right, headerBarRectangle.Bottom);
     }
     base.OnPaint(e);
 }
        /// <summary>
        /// Draws the visual representation of activity at design time.
        /// </summary>
        /// <param name="e">ActivityDesignerPaintEventArgs holding drawing arguments</param>
        protected virtual void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            ActivityDesignerPaint.DrawDesignerBackground(e.Graphics, this);

            if (!String.IsNullOrEmpty(Text) && !TextRectangle.Size.IsEmpty)
            {
                Font font = (SmartTagVisible) ? e.DesignerTheme.BoldFont : e.DesignerTheme.Font;
                ActivityDesignerPaint.DrawText(e.Graphics, font, Text, TextRectangle, StringAlignment.Near, e.AmbientTheme.TextQuality, e.DesignerTheme.ForegroundBrush);
            }

            if (Image != null && !ImageRectangle.Size.IsEmpty)
                ActivityDesignerPaint.DrawImage(e.Graphics, Image, ImageRectangle, DesignerContentAlignment.Fill);
        }
        bool IWorkflowDesignerMessageSink.OnPaint(PaintEventArgs e, Rectangle viewPort)
        {
            try
            {
                Rectangle bounds = Bounds;
                if (IsVisible && viewPort.IntersectsWith(bounds))
                {
                    GlyphManager glyphManager = GetService(typeof(IDesignerGlyphProviderService)) as GlyphManager;
                    bounds.Width += 1; bounds.Height += 1;

                    using (GraphicsPath graphicsPath = ActivityDesignerPaint.GetDesignerPath(this, Point.Empty, new Size(DesignerTheme.BorderWidth, DesignerTheme.BorderWidth), DesignerEdges.All, false))
                    using (Region clipRegion = new Region(graphicsPath))
                    {
                        Region oldRegion = e.Graphics.Clip;
                        clipRegion.Intersect(oldRegion);
                        clipRegion.Intersect(viewPort);

                        bool restoredClipState = false;
                        try
                        {
                            ActivityDesignerPaintEventArgs eventArgs = new ActivityDesignerPaintEventArgs(e.Graphics, bounds, viewPort, DesignerTheme);

                            e.Graphics.Clip = clipRegion;
                            OnPaint(eventArgs);
                            e.Graphics.Clip = oldRegion;
                            restoredClipState = true;

                            if (glyphManager != null)
                                glyphManager.DrawDesignerGlyphs(eventArgs, this);

                            DrawingState &= (~DrawingStates.InvalidDraw);
                        }
                        catch
                        {
                            //Eat the exception thrown
                            DrawingState |= DrawingStates.InvalidDraw;
                        }
                        finally
                        {
                            if (!restoredClipState)
                                e.Graphics.Clip = oldRegion;

                            if (DrawingState != DrawingStates.Valid)
                                ActivityDesignerPaint.DrawInvalidDesignerIndicator(e.Graphics, this);
                        }
                    }
                }
            }
            catch
            {
            }
            return true;
        }
        internal override void OnPaintContainedDesigners(ActivityDesignerPaintEventArgs e)
        {
            //Draw all the activity designers contained by the activity designer
            //We know that all the children which are in drawing range will be always
            //consecutive both for parallel and for sequential containers hence
            //once we go in the invisible range we bail out of drawing logic for rest of
            //the children
            bool bDrawingVisibleChildren = false;

            foreach (ActivityDesigner activityDesigner in ContainedDesigners)
            {
                Rectangle designerBounds = activityDesigner.Bounds;
                if (e.ViewPort.IntersectsWith(designerBounds))
                {
                    bDrawingVisibleChildren = true;
                    using (PaintEventArgs paintEventArgs = new PaintEventArgs(e.Graphics, e.ViewPort))
                    {
                        ((IWorkflowDesignerMessageSink)activityDesigner).OnPaint(paintEventArgs, e.ViewPort);
                    }
                }
                else
                {
                    if (bDrawingVisibleChildren)
                        break;
                }
            }
        }
Пример #60
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            Graphics graphics = e.Graphics;
            ActivityDesignerTheme designerTheme = e.DesignerTheme;
            AmbientTheme ambientTheme = e.AmbientTheme;

#if DEBUG
            try
            {
#endif
            this.RootDesignerLayout.OnPaint(graphics, designerTheme, ambientTheme);
            this.PaintContainedDesigners(e);
#if DEBUG
            }
            catch (Exception exception)
            {
                Trace.WriteLine(String.Format(
                    System.Globalization.CultureInfo.InvariantCulture,
                    "Unhandled exception in {0}.OnPaint: {1}",
                    typeof(StateDesigner), exception));
            }
#endif
        }