internal static GraphicsPath GetDesignerPath(ActivityDesigner designer, Rectangle bounds, ActivityDesignerTheme designerTheme)
        {
            GraphicsPath designerPath = new GraphicsPath();

            if (designer == GetSafeRootDesigner(designer.Activity.Site) && ((IWorkflowRootDesigner)designer).InvokingDesigner == null)
            {
                designerPath.AddRectangle(bounds);
            }
            else
            {
                // Work around: This should come from AmbientTheme.ArcDiameter
                // but it is internal
                int arcDiameter = 8;
                if (designerTheme != null && designerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle)
                {
                    designerPath.AddPath(ActivityDesignerPaint.GetRoundedRectanglePath(bounds, arcDiameter), true);
                }
                else
                {
                    designerPath.AddRectangle(bounds);
                }
            }

            return(designerPath);
        }
Exemple #2
0
        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);
        }
 internal void Draw(Graphics graphics)
 {
     if ((this.transparency != 0f) && (this.buttons.Count != 0))
     {
         ActivityDesignerPaint.Draw3DButton(graphics, null, this.Bounds, this.transparency - 0.1f, ButtonState.Normal);
         for (int i = 0; i < this.buttons.Count; i++)
         {
             Rectangle    buttonBounds = this.GetButtonBounds(i);
             ActionButton button       = this.buttons[i];
             if (button.StateImages.Length == 1)
             {
                 Image image = button.StateImages[0];
                 if ((button.State == ActionButton.States.Normal) || (button.State == ActionButton.States.Disabled))
                 {
                     buttonBounds.Inflate(-2, -2);
                     ActivityDesignerPaint.DrawImage(graphics, image, buttonBounds, new Rectangle(Point.Empty, image.Size), DesignerContentAlignment.Fill, this.transparency, button.State == ActionButton.States.Disabled);
                 }
                 else
                 {
                     ButtonState buttonState = (button.State == ActionButton.States.Highlight) ? ButtonState.Normal : ButtonState.Pushed;
                     ActivityDesignerPaint.Draw3DButton(graphics, image, buttonBounds, this.transparency, buttonState);
                 }
             }
             else
             {
                 Image image2 = this.buttons[i].StateImages[(int)this.buttons[i].State];
                 buttonBounds.Inflate(-2, -2);
                 ActivityDesignerPaint.DrawImage(graphics, image2, buttonBounds, new Rectangle(Point.Empty, image2.Size), DesignerContentAlignment.Fill, this.transparency, false);
             }
         }
     }
 }
        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 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);
                }
            }
        }
Exemple #6
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);
                    }
                }
            }
        }
Exemple #7
0
        protected override Size OnLayoutSize(ActivityDesignerLayoutEventArgs e)
        {
            Size size = base.OnLayoutSize(e);
            CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;

            if ((this.Expanded && (base.ActiveDesigner == this)) && (designerTheme != null))
            {
                if (this.HelpText.Length > 0)
                {
                    this.helpTextSize = ActivityDesignerPaint.MeasureString(e.Graphics, designerTheme.Font, this.HelpText, StringAlignment.Center, DefaultHelpTextSize);
                }
                size.Height += designerTheme.ConnectorSize.Height;
                foreach (ActivityDesigner designer in this.ContainedDesigners)
                {
                    Size size2 = designer.Size;
                    size.Width   = Math.Max(size.Width, size2.Width);
                    size.Height += size2.Height;
                    size.Height += designerTheme.ConnectorSize.Height;
                }
                if (this.ContainedDesigners.Count == 0)
                {
                    Rectangle helpTextRectangle = this.HelpTextRectangle;
                    size.Width   = Math.Max(helpTextRectangle.Width, size.Width);
                    size.Height += helpTextRectangle.Height;
                    size.Height += designerTheme.ConnectorSize.Height;
                }
                size.Width  = Math.Max(size.Width, designerTheme.Size.Width);
                size.Width += 3 * e.AmbientTheme.Margin.Width;
                size.Width += 2 * e.AmbientTheme.SelectionSize.Width;
                size.Height = Math.Max(size.Height, designerTheme.Size.Height);
            }
            return(size);
        }
Exemple #8
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 override bool OnPaint(PaintEventArgs eventArgs, Rectangle viewPort, AmbientTheme ambientTheme)
        {
            bool messageHandled = false;

            if (this.draggedDesignerImages != null && DropTargetDesigner is FreeformActivityDesigner)
            {
                using (Region clipRegion = new Region(ActivityDesignerPaint.GetDesignerPath(ParentView.RootDesigner, false)))
                {
                    Region oldRegion = eventArgs.Graphics.Clip;
                    eventArgs.Graphics.Clip = clipRegion;

                    Point[] locations = GetDesignerLocations(DragInitiationPoint, this.movedDesignerImagePoint, DraggedActivities);
                    Debug.Assert(locations.Length == DraggedActivities.Count);
                    Debug.Assert(this.draggedDesignerImages.Count == DraggedActivities.Count);

                    for (int i = 0; i < this.draggedDesignerImages.Count; i++)
                    {
                        Size imageSize = this.draggedDesignerImages[i].Size;
                        ActivityDesignerPaint.DrawImage(eventArgs.Graphics, this.draggedDesignerImages[i], new Rectangle(new Point(locations[i].X - 2 * ambientTheme.Margin.Width, locations[i].Y - 2 * ambientTheme.Margin.Height), imageSize), new Rectangle(Point.Empty, imageSize), DesignerContentAlignment.Fill, 0.4f, false);
                    }

                    eventArgs.Graphics.Clip = oldRegion;
                }
            }
            else
            {
                messageHandled = base.OnPaint(eventArgs, viewPort, ambientTheme);
            }

            return(messageHandled);
        }
        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 void DrawScrollIndicators(Graphics graphics)
        {
            Image scrollIndicatorImage = AmbientTheme.ScrollIndicatorImage;

            if (scrollIndicatorImage != null)
            {
                WorkflowView parentView                = base.ParentView;
                Size         viewPortSize              = parentView.ViewPortSize;
                Point        scrollPosition            = parentView.ScrollPosition;
                Rectangle[]  scrollIndicatorRectangles = this.ScrollIndicatorRectangles;
                if (scrollPosition.X > 0)
                {
                    ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ScrollIndicatorImage, scrollIndicatorRectangles[0], (float)0.7f);
                }
                if (scrollPosition.X < (parentView.HScrollBar.Maximum - viewPortSize.Width))
                {
                    scrollIndicatorImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
                    ActivityDesignerPaint.DrawImage(graphics, scrollIndicatorImage, scrollIndicatorRectangles[1], (float)0.7f);
                    scrollIndicatorImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }
                if (scrollPosition.Y > 0)
                {
                    scrollIndicatorImage.RotateFlip(RotateFlipType.Rotate90FlipX);
                    ActivityDesignerPaint.DrawImage(graphics, scrollIndicatorImage, scrollIndicatorRectangles[2], (float)0.7f);
                    scrollIndicatorImage.RotateFlip(RotateFlipType.Rotate90FlipX);
                }
                if (scrollPosition.Y < (parentView.VScrollBar.Maximum - viewPortSize.Height))
                {
                    scrollIndicatorImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
                    ActivityDesignerPaint.DrawImage(graphics, scrollIndicatorImage, scrollIndicatorRectangles[3], (float)0.7f);
                    scrollIndicatorImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
                }
            }
        }
        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);
            }
        }
            public override void Draw(Graphics graphics)
            {
                GraphicsContainer container = graphics.BeginContainer();
                Rectangle         bounds    = base.Bounds;

                using (Region region = new Region(new Rectangle(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1)))
                {
                    graphics.Clip = region;
                    StringFormat format = new StringFormat {
                        Alignment     = StringAlignment.Center,
                        LineAlignment = StringAlignment.Center,
                        Trimming      = StringTrimming.Character,
                        FormatFlags   = StringFormatFlags.NoWrap
                    };
                    int maxVisibleItems = base.MaxVisibleItems;
                    int scrollPosition  = base.ScrollPosition;
                    for (int i = scrollPosition; (i < base.Items.Count) && (i < (scrollPosition + maxVisibleItems)); i++)
                    {
                        System.Workflow.ComponentModel.Design.ItemInfo itemInfo = base.Items[i];
                        Rectangle      itemBounds   = base.GetItemBounds(itemInfo);
                        int            pageFoldSize = itemBounds.Width / 5;
                        GraphicsPath[] pathArray    = ActivityDesignerPaint.GetPagePaths(itemBounds, pageFoldSize, DesignerContentAlignment.TopRight);
                        using (GraphicsPath path = pathArray[0])
                        {
                            using (GraphicsPath path2 = pathArray[1])
                            {
                                Brush white = Brushes.White;
                                if (base.SelectedItem == itemInfo)
                                {
                                    white = PageStrip.SelectionBrush;
                                }
                                else if (base.HighlitedItem == itemInfo)
                                {
                                    white = PageStrip.HighliteBrush;
                                }
                                graphics.FillPath(white, path);
                                graphics.DrawPath(Pens.DarkBlue, path);
                                graphics.FillPath(Brushes.White, path2);
                                graphics.DrawPath(Pens.DarkBlue, path2);
                                if (itemInfo.Image == null)
                                {
                                    itemBounds.Y      += pageFoldSize;
                                    itemBounds.Height -= pageFoldSize;
                                    graphics.DrawString((i + 1).ToString(CultureInfo.CurrentCulture), Control.DefaultFont, SystemBrushes.ControlText, itemBounds, format);
                                }
                                else
                                {
                                    itemBounds.Y      += pageFoldSize;
                                    itemBounds.Height -= pageFoldSize;
                                    itemBounds.X      += (itemBounds.Width - itemBounds.Height) / 2;
                                    itemBounds.Width   = itemBounds.Height;
                                    itemBounds.Inflate(-2, -2);
                                    ActivityDesignerPaint.DrawImage(graphics, itemInfo.Image, itemBounds, DesignerContentAlignment.Center);
                                }
                            }
                        }
                    }
                }
                graphics.EndContainer(container);
            }
Exemple #14
0
            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);
            }
        private void DrawButton(Graphics graphics, ScrollButton scrollButton)
        {
            Rectangle buttonBounds = base.GetButtonBounds(scrollButton);

            if (base.Orientation == Orientation.Horizontal)
            {
                buttonBounds.Inflate(-base.itemStrip.ItemSize.Width / 6, -base.itemStrip.ItemSize.Height / 4);
            }
            else
            {
                buttonBounds.Inflate(-base.itemStrip.ItemSize.Width / 4, -base.itemStrip.ItemSize.Height / 6);
            }
            if (base.ActiveButton == scrollButton)
            {
                buttonBounds.Offset(1, 1);
                Size size = (base.Orientation == Orientation.Horizontal) ? new Size(0, 2) : new Size(2, 0);
                buttonBounds.Inflate(size.Width, size.Height);
                graphics.FillRectangle(SelectionBrush, buttonBounds);
                graphics.DrawRectangle(Pens.Black, buttonBounds);
                buttonBounds.Inflate(-size.Width, -size.Height);
            }
            using (GraphicsPath path = ActivityDesignerPaint.GetScrollIndicatorPath(buttonBounds, scrollButton))
            {
                graphics.FillPath(Brushes.Black, path);
                graphics.DrawPath(Pens.Black, path);
            }
        }
        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);
                }
            }
        }
Exemple #17
0
            protected override void OnPaint(PaintEventArgs paintArgs)
            {
                Graphics graphics = paintArgs.Graphics;

                graphics.FillRectangle(SystemBrushes.Window, this.formRectangle);
                graphics.DrawRectangle(SystemPens.ControlDarkDark, this.formRectangle.X, this.formRectangle.Y, this.formRectangle.Width - 1, this.formRectangle.Height - 1);
                using (Brush brush = new LinearGradientBrush(new Point(this.leftGradientRectangle.Left, this.leftGradientRectangle.Top), new Point(this.leftGradientRectangle.Right, this.leftGradientRectangle.Top), SystemColors.Window, SystemColors.ScrollBar))
                {
                    graphics.FillRectangle(brush, this.leftGradientRectangle);
                }
                for (int i = 0; i < this.enabledItems.Count; i++)
                {
                    Rectangle itemBounds = this.GetItemBounds(i);
                    if (this.activeIndex == i)
                    {
                        graphics.FillRectangle(SystemBrushes.InactiveCaptionText, itemBounds.X, itemBounds.Y, itemBounds.Width - 1, itemBounds.Height - 1);
                        graphics.DrawRectangle(SystemPens.ActiveCaption, itemBounds.X, itemBounds.Y, itemBounds.Width - 1, itemBounds.Height - 1);
                    }
                    if (this.enabledItems[i].Image != null)
                    {
                        Point location = new Point(itemBounds.Left + 3, itemBounds.Top + 3);
                        Size  size     = this.enabledItems[i].Image.Size;
                        graphics.DrawImage(this.enabledItems[i].Image, new Rectangle(location, size), new Rectangle(Point.Empty, size), GraphicsUnit.Pixel);
                    }
                    Rectangle boundingRect = new Rectangle(((itemBounds.Left + 20) + 5) + 2, itemBounds.Top + 1, this.itemWidth - 0x1d, this.itemHeight - 3);
                    int       num2         = boundingRect.Height - this.maxTextHeight;
                    num2 = (num2 > 0) ? (num2 / 2) : 0;
                    boundingRect.Height        = Math.Min(boundingRect.Height, this.maxTextHeight);
                    boundingRect.Y            += num2;
                    graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                    string text = this.enabledItems[i].Text.Replace("&", "");
                    ActivityDesignerPaint.DrawText(graphics, this.Font, text, boundingRect, StringAlignment.Near, TextQuality.Aliased, SystemBrushes.ControlText);
                }
            }
        //

        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);
            }
        }
        public override void OnPaintWorkflow(PaintEventArgs e, ViewPortData viewPortData)
        {
            Graphics  graphics     = e.Graphics;
            Bitmap    memoryBitmap = viewPortData.MemoryBitmap;
            Rectangle destination  = new Rectangle(Point.Empty, memoryBitmap.Size);

            ActivityDesignerPaint.DrawImage(graphics, memoryBitmap, destination, destination, DesignerContentAlignment.Fill, 1f, WorkflowTheme.CurrentTheme.AmbientTheme.DrawGrayscale);
        }
Exemple #20
0
                protected override void OnPaint(PaintEventArgs e)
                {
                    base.OnPaint(e);
                    Rectangle formRectangle = this.parent.formRectangle;

                    formRectangle.Offset(-ItemPalette.Palette.DropShadowWidth, -ItemPalette.Palette.DropShadowWidth);
                    ActivityDesignerPaint.DrawDropShadow(e.Graphics, formRectangle, Color.Black, 4, LightSourcePosition.Top | LightSourcePosition.Left, 0.2f, false);
                }
 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);
     }
 }
Exemple #22
0
 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);
 }
        private Rectangle GetActionBounds(int actionIndex)
        {
            Rectangle     destination = new Rectangle(Point.Empty, base.ParentView.ViewPortSize);
            DynamicAction action      = this.actions[actionIndex];

            destination.Inflate(-action.DockMargin.Width, -action.DockMargin.Height);
            return(new Rectangle(ActivityDesignerPaint.GetRectangleFromAlignment(action.DockAlignment, destination, action.Bounds.Size).Location, action.Bounds.Size));
        }
Exemple #24
0
            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 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);
            }
        }
        protected void DrawConnectors(Graphics graphics, Pen pen, Point[] points, LineAnchor startCap, LineAnchor endCap)
        {
            Size empty      = Size.Empty;
            Size maxCapSize = Size.Empty;
            CompositeDesignerTheme designerTheme = base.DesignerTheme as CompositeDesignerTheme;

            if (designerTheme != null)
            {
                empty      = new Size(designerTheme.ConnectorSize.Width / 3, designerTheme.ConnectorSize.Height / 3);
                maxCapSize = designerTheme.ConnectorSize;
            }
            ActivityDesignerPaint.DrawConnectors(graphics, pen, points, empty, maxCapSize, startCap, endCap);
        }
        /// <summary>
        /// Layouts the visual cues inside Header/Footer
        /// </summary>
        /// <param name="e">ActivityDesignerLayoutEventArgs holding layouting arguments</param>
        public virtual void OnLayout(ActivityDesignerLayoutEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (!String.IsNullOrEmpty(Text) && e.DesignerTheme != null && e.DesignerTheme.Font != null)
            {
                using (Font font = new Font(e.DesignerTheme.Font.FontFamily, e.DesignerTheme.Font.SizeInPoints + 1.0f, FontStyle.Bold))
                    this.textSize = ActivityDesignerPaint.MeasureString(e.Graphics, font, Text, StringAlignment.Center, Size.Empty);
            }
        }
Exemple #29
0
        protected void DrawConnectors(Graphics graphics, Pen pen, Point[] points, LineAnchor startCap, LineAnchor endCap)
        {
            Size arrowCapSize = Size.Empty;
            Size maxCapSize   = Size.Empty;

            CompositeDesignerTheme compositeDesignerTheme = DesignerTheme as CompositeDesignerTheme;

            if (compositeDesignerTheme != null)
            {
                arrowCapSize = new Size(compositeDesignerTheme.ConnectorSize.Width / 3, compositeDesignerTheme.ConnectorSize.Height / 3);
                maxCapSize   = compositeDesignerTheme.ConnectorSize;
            }
            ActivityDesignerPaint.DrawConnectors(graphics, pen, points, arrowCapSize, maxCapSize, startCap, endCap);
        }
        public override void OnPaintWorkflow(PaintEventArgs e, ViewPortData viewPortData)
        {
            Graphics graphics = e.Graphics;

            Debug.Assert(graphics != null);

            //Get the drawing canvas
            Bitmap memoryBitmap = viewPortData.MemoryBitmap;

            Debug.Assert(memoryBitmap != null);
            Rectangle bitmapArea = new Rectangle(Point.Empty, memoryBitmap.Size);

            ActivityDesignerPaint.DrawImage(graphics, memoryBitmap, bitmapArea, bitmapArea, DesignerContentAlignment.Fill, 1.0f, WorkflowTheme.CurrentTheme.AmbientTheme.DrawGrayscale);
        }