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);
            }
        }
Exemple #2
0
        protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
        {
            Rectangle bounds          = GetBounds(designer, false);
            Rectangle activatedBounds = GetBounds(designer, activated);
            Region    clipRegion      = null;
            Region    oldClipRegion   = graphics.Clip;

            try
            {
                if (oldClipRegion != null)
                {
                    clipRegion = oldClipRegion.Clone();
                    if (activated)
                    {
                        clipRegion.Union(activatedBounds);
                    }
                    graphics.Clip = clipRegion;
                }

                if (activated)
                {
                    graphics.FillRectangle(SystemBrushes.ButtonFace, activatedBounds);
                    graphics.DrawRectangle(SystemPens.ControlDarkDark, activatedBounds.Left, activatedBounds.Top, activatedBounds.Width - 1, activatedBounds.Height - 1);

                    activatedBounds.X     += bounds.Width + ambientTheme.Margin.Width;
                    activatedBounds.Width -= (bounds.Width + 2 * ambientTheme.Margin.Width);

                    using (GraphicsPath dropDownIndicator = ActivityDesignerPaint.GetScrollIndicatorPath(activatedBounds, ScrollButton.Down))
                    {
                        graphics.FillPath(SystemBrushes.ControlText, dropDownIndicator);
                        graphics.DrawPath(SystemPens.ControlText, dropDownIndicator);
                    }
                }

                ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill);
            }
            finally
            {
                if (clipRegion != null)
                {
                    graphics.Clip = oldClipRegion;
                    clipRegion.Dispose();
                }
            }
        }
        protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
        {
            Rectangle bounds = this.GetBounds(designer, false);
            Rectangle rect   = this.GetBounds(designer, activated);
            Region    region = null;
            Region    clip   = graphics.Clip;

            try
            {
                if (clip != null)
                {
                    region = clip.Clone();
                    if (activated)
                    {
                        region.Union(rect);
                    }
                    graphics.Clip = region;
                }
                if (activated)
                {
                    graphics.FillRectangle(SystemBrushes.ButtonFace, rect);
                    graphics.DrawRectangle(SystemPens.ControlDarkDark, rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
                    rect.X     += bounds.Width + ambientTheme.Margin.Width;
                    rect.Width -= bounds.Width + (2 * ambientTheme.Margin.Width);
                    using (GraphicsPath path = ActivityDesignerPaint.GetScrollIndicatorPath(rect, ScrollButton.Down))
                    {
                        graphics.FillPath(SystemBrushes.ControlText, path);
                        graphics.DrawPath(SystemPens.ControlText, path);
                    }
                }
                ActivityDesignerPaint.DrawImage(graphics, AmbientTheme.ConfigErrorImage, bounds, DesignerContentAlignment.Fill);
            }
            finally
            {
                if (region != null)
                {
                    graphics.Clip = clip;
                    region.Dispose();
                }
            }
        }