Ejemplo n.º 1
0
        public override void Render(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds)
        {
            base.Render(g, settings, itemBounds);
            Rectangle headerBounds = itemBounds;

            {
                headerBounds.Y     += itemBounds.Height - HeaderHeight;
                headerBounds.Width -= 1;
                headerBounds.Height = this.HeaderHeight - 1;
            }
            g.FillRectangle(settings.Header.Brush, headerBounds);
            settings.DrawCarvedBorder(g, settings.LightBorder, settings.DarkBorder, itemBounds);
            settings.DrawCarvedText(g, settings.LightText, settings.DarkText, headerBounds, this.Name, settings.Font);
        }
Ejemplo n.º 2
0
        public override void Render(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds)
        {
            base.Render(g, settings, itemBounds);
            if (this.Hot)
            {
                settings.DrawHotButtonPanel(g, itemBounds, 0.5);
                settings.DrawHotButtonBorder(g, itemBounds);
            }
            if (this.SmallImage != null)
            {
                Rectangle r = GetIconBounds(itemBounds);
                int       x = r.Left + (r.Width - this.SmallImage.Width) / 2;
                int       y = r.Top + (r.Height - this.SmallImage.Height) / 2;
                if (this.Enabled)
                {
                    g.DrawImage(this.SmallImage, new Rectangle(x, y, this.SmallImage.Width, this.SmallImage.Height));
                }
                else
                {
                    ControlPaint.DrawImageDisabled(g, this.SmallImage, x, y, Color.Transparent);
                }
            }
            {
                Rectangle r    = GetPanelBounds(itemBounds);
                SizeF     size = g.MeasureString(this.Name, settings.Font);
                int       tx   = r.Left + MenuButtonLeftPadding;
                int       ty   = r.Top + (int)(r.Height - size.Height) / 2;
                Font      font = settings.Font;

                if (this.Enabled)
                {
                    g.DrawString(this.Name, font, settings.TabText.Brush, tx, ty);
                }
                else
                {
                    Rectangle tr = new Rectangle(tx, ty, (int)size.Width, (int)size.Height);
                    settings.DrawCarvedText(g, settings.MenuLightText, settings.MenuDarkText, tr, this.Name, font);
                }
            }
            if (this.DropDown != null)
            {
                int       x  = itemBounds.Right - MenuDropDownArrowArea + (MenuDropDownArrowArea - MenuDropDownWidth) / 2;
                int       y  = itemBounds.Top + (itemBounds.Height - MenuDropDownHeight) / 2;
                Rectangle dr = new Rectangle(x, y, MenuDropDownWidth, MenuDropDownHeight);
                settings.DrawRightDropDownTriangle(g, settings.ButtonDropDownLight, settings.ButtonDropDownDark, dr);
            }
        }
Ejemplo n.º 3
0
        private void RenderText(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds, Rectangle iconBounds)
        {
            Font  font = settings.Font;
            SizeF size = g.MeasureString(this.Name, font);
            int   tx   = 0;
            int   ty   = 0;

            switch (this.ItemSize)
            {
            case RibbonItemSize.Big:
            {
                tx = itemBounds.Left + (int)(itemBounds.Width - size.Width) / 2;
                ty = iconBounds.Bottom + (int)(itemBounds.Bottom - iconBounds.Bottom - size.Height - ButtonDropDownHeight - ButtonTextPadding * 2) / 2;
            }
            break;

            case RibbonItemSize.Small:
            {
                tx = iconBounds.Right + ButtonTextPadding;
                ty = iconBounds.Top + (int)(iconBounds.Height - size.Height) / 2;
            }
            break;

            default:
                return;
            }
            if (this.Enabled)
            {
                Brush textBrush = settings.TabText.Brush;
                g.DrawString(this.Name, font, textBrush, tx, ty);
            }
            else
            {
                Rectangle r = new Rectangle(tx, ty, (int)size.Width, (int)size.Height);
                settings.DrawCarvedText(g, settings.LightBorder, settings.Border, r, this.Name, font);
            }
        }