Пример #1
0
        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem item        = e.Item;
            ToolStrip     toolStrip   = e.ToolStrip;
            Graphics      graphics    = e.Graphics;
            bool          rightToLeft = item.RightToLeft == RightToLeft.Yes;

            new SmoothingModeGraphics(graphics);
            this.RenderOverflowBackground(e, rightToLeft);
            bool      flag2 = toolStrip.Orientation == Orientation.Horizontal;
            Rectangle empty = Rectangle.Empty;

            if (rightToLeft)
            {
                empty = new Rectangle(0, item.Height - 8, 10, 5);
            }
            else
            {
                empty = new Rectangle(item.Width - 12, item.Height - 8, 10, 5);
            }
            ArrowDirection direction = flag2 ? ArrowDirection.Down : ArrowDirection.Right;
            int            x         = (!rightToLeft || !flag2) ? 1 : -1;

            empty.Offset(x, 1);
            Color color = toolStrip.Enabled ? this.ColorTable.Fore : SystemColors.ControlDark;

            using (Brush brush = new SolidBrush(color))
            {
                RenderHelperStrip.RenderArrowInternal(graphics, empty, direction, brush);
            }
            if (flag2)
            {
                using (Pen pen = new Pen(color))
                {
                    graphics.DrawLine(pen, (int)(empty.Right - 8), (int)(empty.Y - 2), (int)(empty.Right - 2), (int)(empty.Y - 2));
                    graphics.DrawLine(pen, (int)(empty.Right - 8), (int)(empty.Y - 1), (int)(empty.Right - 2), (int)(empty.Y - 1));
                    return;
                }
            }
            using (Pen pen2 = new Pen(color))
            {
                graphics.DrawLine(pen2, empty.X, empty.Y, empty.X, empty.Bottom - 1);
                graphics.DrawLine(pen2, empty.X, empty.Y + 1, empty.X, empty.Bottom);
            }
        }