예제 #1
0
        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)); 
            }
        }
예제 #2
0
        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)); 
            }
        }
예제 #3
0
 public abstract void OnPaint(object sender, RibbonElementPaintEventArgs e);
예제 #4
0
        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;
        }
예제 #5
0
 /// <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));
 }