| 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: Enable Check Margins and Image Margins in ContextMenuStrip Controls |
03/30/2017 |
.net-framework |
|
article |
|
|
eb584e71-59da-4012-aaca-dbe1c7c7a156 |
10 |
dotnet-bot |
dotnetcontent |
wpickett |
How to: Enable Check Margins and Image Margins in ContextMenuStrip Controls
You can customize the xref:System.Windows.Forms.ToolStripMenuItem objects in your xref:System.Windows.Forms.MenuStrip control with check marks and custom images.
Example
The following code example demonstrates how to create menu items that have check marks and custom images.
[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#1]
[!code-vbSystem.Windows.Forms.ToolStrip.Misc#1]
[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#60]
[!code-vbSystem.Windows.Forms.ToolStrip.Misc#60]
Set the xref:System.Windows.Forms.ToolStripDropDownMenu.ShowCheckMargin%2A?displayProperty=nameWithType and xref:System.Windows.Forms.ToolStripDropDownMenu.ShowImageMargin%2A?displayProperty=nameWithType properties to specify when check marks and custom images appear in your menu items.
Compiling the Code
This example requires:
- References to the System.Design, 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.ToolStripMenuItem
xref:System.Windows.Forms.ToolStripDropDownMenu
xref:System.Windows.Forms.MenuStrip
xref:System.Windows.Forms.ToolStrip
ToolStrip Control