Margin and Shadow in WinForms ContextMenuStrip (ContextMenuStripEx)
4 Feb 20251 minute to read
Margin Setting
We can set margin for the context menu to indicates whether a check mark should appear before the text of the menu item by using the ShowCheckMargin property. Also to show image separately, use the ShowImageMargin property.
The below code snippet will explain how to set the margin for ContextMenuStripEx control.
this.contextMenuStripEx.ShowCheckMargin = true;
this.contextMenuStripEx.ShowImageMargin = true;Me.contextMenuStripEx.ShowCheckMargin = True
Me.contextMenuStripEx.ShowImageMargin = True
Shadow Setting
The shadow option for ContextMenuStripEx control refers to shows a three dimensional shadow for the context menu. It can be enabled by using the DropShadowEnabled property.
The below code snippet will explain how to set shadow for ContextMenuStripEx control.
this.contextMenuStripEx1.DropShadowEnabled = true;Me.contextMenuStripEx1.DropShadowEnabled = True