Differences between .ContextMenu and .ContextMenuStrip

What is the difference between .ContextMenu and .ContextMenuStrip in Windows Forms?

I already know what ContextMenu , but how is ContextMenuStrip different from ContextMenu ?

+45
c # winforms menu
Dec 09 '11 at 7:21
source share
5 answers

http://www.informit.com/articles/article.aspx?p=606224&seqNum=2

You may wonder why Microsoft has replaced the valuable and popular control with a newbie. The ContextMenuStrip control takes a good idea and makes it better. It works the same as the ContextMenu control. You still attach the ContextMenuStrip control to another user control by changing which controls the ContextMenuStrip property. However, Microsoft has greatly improved the features you can add to ContextMenuStrip cont ...

Check out the examples on MSDN:

http://msdn.microsoft.com/en-us/library/system.windows.forms.contextmenustrip.aspx

ContextMenuStrip replaces ContextMenu . You can associate ContextMenuStrip with any control and by right-clicking automatically displays the context menu. You can show ContextMenuStrip programmatically using the Show method. ContextMenuStrip supports canceled open and close events for handling dynamic populations and multiple click scripts. ContextMenuStrip supports images, menu item verification status, text, access keys, shortcuts, and cascading menus.

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.contextmenustrip.aspx

If a ContextMenu also been assigned to the control, ContextMenu takes precedence over ContextMenuStrip .

+36
Dec 09 2018-11-11T00:
source share

From doc

ContextMenuStrip replaces ContextMenu.

+7
Dec 09 '11 at 7:28
source share

According to MSDN , ContextMenuStrip replaces the ContextMenu class:

Although ContextMenuStrip replaces and adds the functionality of ContextMenu for managing previous versions, ContextMenu is retained for both backward compatibility and future use if you choose.

Source: MSDN - ContextMenu

Edit: why -1?

+3
Dec 9 '11 at 7:28
source share

contextMenu - msdn and also contextMenuStrip - msdn

contextMenu - represents a context menu. Although ContextMenuStrip replaces and adds features to previous versions of ContextMenu controls, ContextMenu is retained for both backward compatibility and future use if you choose.

ContextMenuStrip replaces and adds functionality to the previous version of ContextMenu control

+2
Dec 09 2018-11-11T00:
source share

If you click on ContextMenu , you will notice that ContextMenuStrip replaces it, but ContextMenu left for compatibility purposes.

+1
Dec 09 '11 at 7:28
source share



All Articles