public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(
                Owner, e.Graphics, e.Clip, this));

            if (!string.IsNullOrEmpty(Text))
            {
                Owner.Renderer.OnRenderRibbonItemText(new RibbonTextEventArgs(
                        Owner, e.Graphics, e.Clip, this,
                        Rectangle.FromLTRB(
                            Bounds.Left + Owner.ItemMargin.Left,
                            Bounds.Top + Owner.ItemMargin.Top,
                            Bounds.Right - Owner.ItemMargin.Right,
                            Bounds.Bottom - Owner.ItemMargin.Bottom), Text, FontStyle.Bold)); 
            }
        }
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            if (DrawBackground)
            {
                Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
            }

            foreach (RibbonItem item in Items)
            {
                item.OnPaint(this, new RibbonElementPaintEventArgs(item.Bounds, e.Graphics, RibbonElementSizeMode.Compact));
            }

            if (DrawBackground)
            {
                Owner.Renderer.OnRenderRibbonItemBorder(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this)); 
            }
        }
 public abstract void OnPaint(object sender, RibbonElementPaintEventArgs e);
        public override void OnPaint(object sender, RibbonElementPaintEventArgs e)
        {
            base.OnPaint(sender, e);

            Color c = this.Color.Equals(Color.Transparent) ? Color.White : Color;

            int h = e.Mode == RibbonElementSizeMode.Large ? ImageColorHeight : SmallImageColorHeight;

            Rectangle colorFill = Rectangle.FromLTRB(
                    ImageBounds.Left,
                    ImageBounds.Bottom - h,
                    ImageBounds.Right, 
                    ImageBounds.Bottom
                    );
            SmoothingMode sm = e.Graphics.SmoothingMode;
            e.Graphics.SmoothingMode = SmoothingMode.None;
            using (SolidBrush b = new SolidBrush(c))
            {

                e.Graphics.FillRectangle(b, colorFill);
            }

            if (this.Color.Equals(Color.Transparent))
            {
                e.Graphics.DrawRectangle(Pens.DimGray, colorFill);
            }

            e.Graphics.SmoothingMode = sm;
        }
 /// <summary>
 /// Renders the background of the buton
 /// </summary>
 /// <param name="e"></param>
 private void OnPaintBackground(RibbonElementPaintEventArgs e)
 {
     Owner.Renderer.OnRenderRibbonItem(new RibbonItemRenderEventArgs(Owner, e.Graphics, e.Clip, this));
 }