---
title: "How to: Configure ContextMenuStrip Check Margins and Image Margins"
ms.date: "03/30/2017"
dev_langs: 
  - "csharp"
  - "vb"
helpviewer_keywords: 
  - "context menus [Windows Forms], configuring check and image margins"
  - "ContextMenuStrips [Windows Forms], configuring check and image margins"
  - "margins [Windows Forms], setting check and image in Windows Forms ContextMenuStrips"
ms.assetid: 3391c4c2-0c9e-4aa4-9492-13ff7644bdf2
---
# How to: Configure ContextMenuStrip Check Margins and Image Margins
You can customize a <xref:System.Windows.Forms.ContextMenuStrip> by setting the <xref:System.Windows.Forms.ToolStripDropDownMenu.ShowImageMargin%2A> and <xref:System.Windows.Forms.ToolStripDropDownMenu.ShowCheckMargin%2A> properties in various combinations.  
  
## Example  
 The following code example demonstrates how to set and customize the <xref:System.Windows.Forms.ContextMenuStrip> check and image margins.  
  
 [!code-csharp[System.Windows.Forms.ToolStrip.Misc#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/CS/Program.cs#1)]
 [!code-vb[System.Windows.Forms.ToolStrip.Misc#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/VB/Program.vb#1)]  
[!code-csharp[System.Windows.Forms.ToolStrip.Misc#60](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/CS/Program.cs#60)]
[!code-vb[System.Windows.Forms.ToolStrip.Misc#60](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip.Misc/VB/Program.vb#60)]  
  
## Compiling the Code  
 This example requires:  
  
- References to the System.Design, System.Drawing, and System.Windows.Forms assemblies.  
  
## See also

- <xref:System.Windows.Forms.ContextMenuStrip>
- <xref:System.Windows.Forms.ToolStripDropDown>
- [ToolStrip Control](toolstrip-control-windows-forms.md)
- [How to: Enable Check Margins and Image Margins in ContextMenuStrip Controls](how-to-enable-check-margins-and-image-margins-in-contextmenustrip-controls.md)
