Example #1
0
        protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
        {
            e.Graphics.Clear(e.BackColor);

            if (e.ToolStrip is ToolStripDropDownMenu)
            {
                //base.OnRenderToolStripBackground(e);
                Rectangle rect = e.AffectedBounds;
                //Image image = MenuBackImage.Image;
                //PT.ExpandImage(e.Graphics, image, 10, rect, new Rectangle(0, 0, image.Width, image.Height));
                //e.ToolStrip.Region = new Region(PT.GetRoundRectangle(new Rectangle(rect.Left, rect.Top, rect.Width + 1, rect.Height + 1), 2));

                e.Graphics.FillRectangle(new SolidBrush(UITheme.Default.Colors.MediumLight), rect);

                GraphicsPath path = PaintHelper.GetRoundRectangle(rect, 2);
                e.Graphics.DrawPath(Pens.Gray, path);

                e.Graphics.FillRectangle(Brushes.Silver, new Rectangle(rect.Right - 1, rect.Bottom - 1, 1, 1));
            }
            else
            {
                int def = 0;
                if (e.ToolStrip is ToolStripPro && ((ToolStripPro)e.ToolStrip).HalfRenderBackground)
                {
                    def = 2;
                }

                Image image = BarBackImage.Image;
                PaintHelper.ExpandImage(e.Graphics, image, 5, e.AffectedBounds, new Rectangle(0, def, image.Width, image.Height - def));
            }
            //base.OnRenderToolStripBackground(e);
        }
Example #2
0
        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            Rectangle rect = new Rectangle(0, 0, e.Item.Bounds.Width, e.Item.Bounds.Height);

            const int ItemSize = 71;
            Image     image    = ToolButtonBackImage.Image;

            int x = 0;

            if (e.Item.Pressed)
            {
                x = 1 * ItemSize;
            }
            else if (e.Item.Selected)
            {
                x = 3 * ItemSize;
            }

            if (e.Item is ToolStripButton)
            {
                if (((ToolStripButton)e.Item).Checked)
                {
                    x = 1 * ItemSize;
                }
            }

            PaintHelper.ExpandImage(e.Graphics, image, 5, rect, new Rectangle(x, 0, ItemSize, image.Height));
        }
Example #3
0
        public bool DrawExpand(Graphics graphics, UIControlStatus status, Rectangle targetRectangle, Padding padding)
        {
            if (this.Image == null)
            {
                return(false);
            }

            var rectSource = GetBounds(status);

            if (rectSource.Width <= 0 || rectSource.Height <= 0)
            {
                return(false);
            }

            return(PaintHelper.ExpandImage(graphics, Image, padding, targetRectangle, rectSource));
        }
Example #4
0
        protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripSplitButton tssb = (ToolStripSplitButton)e.Item;
            Rectangle            rect = new Rectangle(0, 0, e.Item.Bounds.Width, e.Item.Bounds.Height);

            const int ItemSize = 71;
            Image     image    = ToolButtonBackImage.Image;

            // button
            int x = 0;

            if (tssb.ButtonPressed)
            {
                x = 1 * ItemSize;
            }
            else if (tssb.ButtonSelected)
            {
                x = 3 * ItemSize;
            }
            PaintHelper.ExpandImage(e.Graphics, image, 5, tssb.ButtonBounds, new Rectangle(x, 0, ItemSize, image.Height));

            // drop down arrow
            x = 0;
            if (tssb.DropDownButtonPressed)
            {
                x = 1 * ItemSize;
            }
            else if (tssb.DropDownButtonSelected)
            {
                x = 3 * ItemSize;
            }
            PaintHelper.ExpandImage(e.Graphics, image, 5, tssb.DropDownButtonBounds, new Rectangle(x, 0, ItemSize, image.Height));

            ToolStripArrowRenderEventArgs tsarea = new ToolStripArrowRenderEventArgs(e.Graphics, e.Item, tssb.DropDownButtonBounds, Color.Black, ArrowDirection.Down);

            DrawArrow(tsarea);
        }