public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                Rectangle rectangle = this.Bounds;

                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillRectangle(backgroundBrush, rectangle);

                Color color1;
                Color color2;
                StateActivity state = (StateActivity)this.ActivityDesigner.Activity;
                if (StateMachineHelpers.IsLeafState(state))
                {
                    color1 = Color.FromArgb(32, designerTheme.BorderColor);
                    color2 = Color.FromArgb(160, designerTheme.BorderColor);
                }
                else
                {
                    if (StateMachineHelpers.IsRootState(state))
                    {
                        color1 = Color.Empty;
                        color2 = Color.FromArgb(128, designerTheme.BorderColor);
                    }
                    else
                    {
                        color1 = Color.FromArgb(16, designerTheme.BorderColor);
                        color2 = Color.FromArgb(16, designerTheme.BorderColor);
                    }
                }

                if (rectangle.Width > 0 && rectangle.Height > 0)
                {
                    using (Brush linearGradientBrush = new LinearGradientBrush(rectangle, color1, color2, LinearGradientMode.Vertical))
                    {
                        graphics.FillRectangle(linearGradientBrush, rectangle);
                        graphics.DrawLine(designerTheme.BorderPen, rectangle.Left, rectangle.Bottom, rectangle.Right, rectangle.Bottom);
                    }
                }

                base.OnPaint(graphics, designerTheme, ambientTheme);
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                GraphicsPath path = StateMachineDesignerPaint.GetDesignerPath(this.ActivityDesigner, this.Bounds, designerTheme);
                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillPath(backgroundBrush, path);

                base.OnPaint(graphics, designerTheme, ambientTheme);

                if (ambientTheme.ShowDesignerBorder)
                    graphics.DrawPath(designerTheme.BorderPen, path);

                if (this.StateDesigner.ContainedDesigners.Count == 0 &&
                    !this.StateDesigner.IsStateCustomActivity)
                {
                    Point location = new Point(this.Location.X, _titleBarLayout.Bounds.Bottom);
                    Size size = new Size(this.Size.Width, this.Size.Height - _titleBarLayout.Bounds.Height);
                    Rectangle rectangle = new Rectangle(location, size);
                    rectangle.Inflate(-1, -1);

                    StateActivity state = (StateActivity)this.StateDesigner.Activity;
                    if (StateMachineHelpers.IsLeafState(state) &&
                        StateMachineHelpers.IsCompletedState(state))
                        return;

                    if (this.StateDesigner.DragDropActive)
                    {
                        Color color = Color.FromArgb(64, designerTheme.ForeColor);
                        using (SolidBrush brush = new SolidBrush(color))
                        {
                            ActivityDesignerPaint.DrawText(
                                graphics,
                                designerTheme.Font,
                                this.StateDesigner.HelpText,
                                rectangle,
                                StringAlignment.Center,
                                ambientTheme.TextQuality,
                                brush);
                        }
                    }
                    else
                    {
                        ActivityDesignerPaint.DrawText(
                            graphics,
                            designerTheme.Font,
                            this.StateDesigner.HelpText,
                            rectangle,
                            StringAlignment.Center,
                            ambientTheme.TextQuality,
                            designerTheme.ForegroundBrush);
                    }
                }
            }
            public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
            {
                GraphicsPath path = StateMachineDesignerPaint.GetDesignerPath(this.ActivityDesigner, this.Bounds, designerTheme);
                Brush backgroundBrush = designerTheme.GetBackgroundBrush(this.Bounds);
                graphics.FillPath(backgroundBrush, path);

                base.OnPaint(graphics, designerTheme, ambientTheme);

                if (ambientTheme.ShowDesignerBorder)
                    graphics.DrawPath(designerTheme.BorderPen, path);
            }
 public override void OnPaint(Graphics graphics, ActivityDesignerTheme designerTheme, AmbientTheme ambientTheme)
 {
     Color empty;
     Color color2;
     Rectangle bounds = base.Bounds;
     Brush backgroundBrush = designerTheme.GetBackgroundBrush(base.Bounds);
     graphics.FillRectangle(backgroundBrush, bounds);
     StateActivity state = (StateActivity) base.ActivityDesigner.Activity;
     if (StateMachineHelpers.IsLeafState(state))
     {
         empty = Color.FromArgb(0x20, designerTheme.BorderColor);
         color2 = Color.FromArgb(160, designerTheme.BorderColor);
     }
     else if (StateMachineHelpers.IsRootState(state))
     {
         empty = Color.Empty;
         color2 = Color.FromArgb(0x80, designerTheme.BorderColor);
     }
     else
     {
         empty = Color.FromArgb(0x10, designerTheme.BorderColor);
         color2 = Color.FromArgb(0x10, designerTheme.BorderColor);
     }
     if ((bounds.Width > 0) && (bounds.Height > 0))
     {
         using (Brush brush2 = new LinearGradientBrush(bounds, empty, color2, LinearGradientMode.Vertical))
         {
             graphics.FillRectangle(brush2, bounds);
             graphics.DrawLine(designerTheme.BorderPen, bounds.Left, bounds.Bottom, bounds.Right, bounds.Bottom);
         }
     }
     base.OnPaint(graphics, designerTheme, ambientTheme);
 }