Beispiel #1
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);
            }
        }
Beispiel #2
0
        private void RenderPanel(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds)
        {
            switch (this.dropDownOpening ? VisualState.Pressed : this.PanelVisualState)
            {
            case VisualState.Hot:
            {
                settings.DrawHotButtonPanel(g, GetHotBoundsForRender(itemBounds), (double)2 / 5);
            }
            break;

            case VisualState.Pressed:
            {
                settings.DrawPressedButtonPanel(g, GetHotBoundsForRender(itemBounds), (double)2.25 / 5);
            }
            break;
            }
        }
Beispiel #3
0
        private void RenderPanel(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds)
        {
            switch (this.dropDownOpening ? RibbonElementState.Pressed : this.State)
            {
            case RibbonElementState.Hot:
            {
                settings.DrawHotButtonPanel(g, itemBounds, (double)2 / 5);
            }
            break;

            case RibbonElementState.Pressed:
            case RibbonElementState.Selected:
            {
                settings.DrawPressedButtonPanel(g, itemBounds, (double)2.25 / 5);
            }
            break;

            default:
                return;
            }
        }