private void RenderBorder(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds) { if (this.ButtonStyle == RibbonButtonStyle.SplitButton && this.BorderVisualState != VisualState.Normal) { settings.DrawHotButtonBorder(g, itemBounds); } switch (this.dropDownOpening ? VisualState.Pressed : this.PanelVisualState) { case VisualState.Hot: { settings.DrawHotButtonBorder(g, GetHotBoundsForRender(itemBounds)); } break; case VisualState.Pressed: { settings.DrawPressedButtonBorder(g, GetHotBoundsForRender(itemBounds)); } break; } }
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); } }
private void RenderBorder(Graphics g, RibbonThemaSettingsBase settings, Rectangle itemBounds) { switch (this.dropDownOpening ? RibbonElementState.Pressed : this.State) { case RibbonElementState.Hot: { settings.DrawHotButtonBorder(g, itemBounds); } break; case RibbonElementState.Pressed: case RibbonElementState.Selected: { settings.DrawPressedButtonBorder(g, itemBounds); } break; } }