
e.Graphics.DrawRectangle(Pens.Black, 1, 0, rc.Width - 2, rc. e.Graphics.FillRectangle(Brushes.DarkGray, rc) Rectangle rc = new Rectangle(Point.Empty, e.Item.Size) Each ToolStripMenuItem can be a command for your application or a parent menu for other submenu items. You can add ToolStripMenuItem objects to the MenuStrip that represent the individual menu commands in the menu structure. If (!e.Item.Selected) base.OnRenderMenuItemBackground(e) The MenuStrip control represents the container for the menu structure of a form. It also provides key handling and multiple document interface (MDI) features. SolidBrush brush = new SolidBrush(_BackColor) Į.Graphics.DrawRectangle(pen, 1, 0, rc.Width - 2, rc.Height - 1) MenuStrip is the top-level container that supersedes MainMenu. If (e.Item.GetType() = typeof(ToolStripHeader)) Protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e) Public HeaderRenderer(Font font, Color textcolor, Color BackgroundColor, Color BorderColor) //: base(new Label())

Private class HeaderRenderer : ToolStripProfessionalRenderer NewParent.Renderer = new HeaderRenderer(_Font, _FontColor, _BackColor, _BorderColor) If (newParent.GetType() = typeof(ContextMenuStrip))

Protected override void OnParentChanged(ToolStrip oldParent, ToolStrip newParent)īase.OnParentChanged(oldParent, newParent) Public ToolStripHeader(string text, Font font, Color textcolor, Color BackgroundColor, Color BorderColor) //: base(new Label()) Public class ToolStripHeader : ToolStripMenuItemįont _Font //= new Font("Segoe UI", 10, FontStyle.Bold,, 1, false)

MENUSTRIP DOSE NOT WORKING CODE
How the code is implemented (new CustomCMSItems.ToolStripHeader("Shifts", new Font("Segoe UI", 10, FontStyle.Bold,, 1, false), Color.Black, Color.LightGray, Color.Red)) It is similar to the other answers but a bit more self contained. I wanted to do the same thing to make a contextmenustrip header, where i could set the background, forground and border colors of a toolstripmenuitem.
