示例#1
0
 protected override void OnPaintSelected(ActivityDesignerPaintEventArgs e, bool primarySelection, Point[] segmentEditPoints)
 {
     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;
             using (Pen pen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1f))
             {
                 StateMachineDesignerPaint.DrawConnector(e.Graphics, pen, new List <Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
             }
             if (base.Source != null)
             {
                 base.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 (base.Target != null)
             {
                 base.Target.OnPaint(e, false);
             }
         }
     }
 }
示例#2
0
 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);
         }
     }
 }
示例#3
0
        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {
            Size   size        = base.OnLayoutSize(e);
            string targetState = this.TargetState;

            if (string.IsNullOrEmpty(targetState))
            {
                targetState = "M";
            }
            Font font = e.DesignerTheme.Font;

            this.targetStateSize = StateMachineDesignerPaint.MeasureString(e.Graphics, font, targetState, StringAlignment.Near, Size.Empty);
            size.Height         += this.targetStateSize.Height;
            return(size);
        }
        protected override void OnPaintSelected(ActivityDesignerPaintEventArgs e, bool primarySelection, Point[] segmentEditPoints)
        {
            if (this.RootStateDesigner != null && this.RootStateDesigner.ActiveDesigner != null)
            {
                return; // we don't draw connectors in the EventDriven view
            }
            StateMachineTheme theme = e.DesignerTheme as StateMachineTheme;

            if (theme != null)
            {
                Size arrowCapSize = new Size(theme.ConnectorSize.Width / 5, theme.ConnectorSize.Height / 5);
                Size maxCapSize   = theme.ConnectorSize;

                using (Pen lineSelectionPen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1))
                {
                    StateMachineDesignerPaint.DrawConnector(e.Graphics,
                                                            lineSelectionPen,
                                                            new List <Point>(ConnectorSegments).ToArray(),
                                                            arrowCapSize,
                                                            maxCapSize,
                                                            theme.ConnectorStartCap,
                                                            theme.ConnectorEndCap);
                }

                if (this.Source != null)
                {
                    this.Source.OnPaint(e, false);
                }

                ReadOnlyCollection <Point> endSegmentEditPoints = ConnectorSegments;
                for (int i = 1; i < endSegmentEditPoints.Count - 1; i++)
                {
                    PaintEditPoints(e, endSegmentEditPoints[i], false);
                }

                for (int i = 0; i < segmentEditPoints.Length; i++)
                {
                    PaintEditPoints(e, segmentEditPoints[i], true);
                }

                if (this.Target != null)
                {
                    this.Target.OnPaint(e, false);
                }
            }
        }
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (this.RootStateDesigner != null && this.RootStateDesigner.ActiveDesigner != null)
            {
                return; // we don't draw connectors in the EventDriven view
            }
            StateMachineTheme theme = e.DesignerTheme as StateMachineTheme;

            if (theme != null)
            {
                Size arrowCapSize = new Size(theme.ConnectorSize.Width / 5, theme.ConnectorSize.Height / 5);
                Size maxCapSize   = theme.ConnectorSize;

                StateMachineDesignerPaint.DrawConnector(e.Graphics,
                                                        theme.ConnectorPen,
                                                        new List <Point>(ConnectorSegments).ToArray(),
                                                        arrowCapSize,
                                                        maxCapSize,
                                                        theme.ConnectorStartCap,
                                                        theme.ConnectorEndCap);
            }
        }