Customize appearance in WinForms Context Menu Strip

18 Nov 20183 minutes to read

Background Color

The BackColor property is to set the background color of WinForms Context Menu Strip. Background color is used to improve the visual appearance of the WinForms Context Menu Strip.

The below code snippet will explain how to set background color of WinForms Context Menu Strip.

this.contextMenuStripEx.BackColor = System.Drawing.Color.SkyBlue;
Me.contextMenuStripEx.BackColor = System.Drawing.Color.SkyBlue

Background Color

Font

The Font property is to set the “FontFamily” and “FontStyle” of WinForms Context Menu Strip.

The below code snippet will explain the procedure to set font for menu items.

this.contextMenuStripEx.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Strikeout);
Me.contextMenuStripEx.Font = New System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Strikeout)

Font

Foreground Color

The ForeColor property is to set foreground color for menu items.

this.contextMenuStripEx.ForeColor = System.Drawing.Color.Red;
Me.contextMenuStripEx.ForeColor = System.Drawing.Color.Red

Foreground

Size

The Size property is to set the height and width of context menu items.

NOTE:
In-order to set size for context menu, set AutoSize property to false.

The below code snippet is to set the size of context menu.

this.contextMenuStripEx.AutoSize = false;
this.contextMenuStripEx.Size = new System.Drawing.Size(200, 250);
Me.contextMenuStripEx.AutoSize = False
Me.contextMenuStripEx.Size = New System.Drawing.Size(200, 250)

Size

Text

The Text property is used to set the caption of WinForms Context Menu Strip.

The below code snippet will explain how to set text for WinForms Context Menu Strip.

this.contextMenuStripEx.Text = "Context Menu";
Me.contextMenuStripEx.Text = "Context Menu"

Text

Background Image

The BackgroundImage property is to set the background image of WinForms Context Menu Strip.

The below code snippet is to set the background image of WinForms Context Menu Strip.

this.contextMenuStripEx.BackgroundImage = System.Drawing.Image.FromFile(@"..\..\..\cut.png");
Me.contextMenuStripEx.BackgroundImage = System.Drawing.Image.FromFile("..\..\..\cut.png")

Background Image