Permalink
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (39 sloc) 2.78 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Configure MenuStrip Check Margins and Image Margins
03/30/2017
.net-framework
dotnet-winforms
article
jsharp
margins, setting in MenuStrip controls
menus, setting margins
MenuStrip control [Windows Forms], configuring check and image margins
45a9075d-4bea-4ce2-9b2c-7619aa39f8ce
9
dotnet-bot
dotnetcontent
wpickett

How to: Configure MenuStrip Check Margins and Image Margins

You can customize a xref:System.Windows.Forms.MenuStrip 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 margins and image margins. The procedure is the same for a xref:System.Windows.Forms.ContextMenuStrip or a xref:System.Windows.Forms.MenuStrip.

[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#60] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#60]

Compiling the Code

This example requires:

  • References to the System, System.Drawing and System.Windows.Forms assemblies.

For information about building this example from the command line for [!INCLUDEvbprvb] or [!INCLUDEcsprcs], see Building from the Command Line or Command-line Building With csc.exe. You can also build this example in [!INCLUDEvsprvs] by pasting the code into a new project. Also see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.

See Also

xref:System.Windows.Forms.MenuStrip
xref:System.Windows.Forms.ContextMenuStrip
xref:System.Windows.Forms.ToolStripDropDown
ToolStrip Control
How to: Enable Check Margins and Image Margins in ContextMenuStrip Controls