mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
1.7 KiB
1.7 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| How to: Handle the ContextMenuStrip Opening Event | 03/30/2017 |
|
|
b661b3dd-7815-4cc2-a1aa-a9a391ab3427 |
How to: Handle the ContextMenuStrip Opening Event
You can customize the behavior of your xref:System.Windows.Forms.ContextMenuStrip control by handling the xref:System.Windows.Forms.ToolStripDropDown.Opening event.
Example
The following code example demonstrates how to handle the xref:System.Windows.Forms.ToolStripDropDown.Opening event. The event handler adds items dynamically to a xref:System.Windows.Forms.ContextMenuStrip control. For the complete code example, see How to: Add ToolStrip Items Dynamically.
[!code-csharpSystem.Windows.Forms.ToolStrip.Misc#42] [!code-vbSystem.Windows.Forms.ToolStrip.Misc#42]
Set the xref:System.ComponentModel.CancelEventArgs.Cancel%2A?displayProperty=nameWithType property to true to prevent the menu from opening.