Differences between .ContextMenu and .ContextMenuStrip

后端 未结 5 2046
悲哀的现实
悲哀的现实 2021-02-06 20:15

What are the differences between .ContextMenu and .ContextMenuStrip in Windows Forms?

I already know what a ContextMenu is, but ho

5条回答
  •  滥情空心
    2021-02-06 21:00

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

    You might wonder why Microsoft has replaced a valuable and popular control with a newcomer. The ContextMenuStrip control takes a good idea and makes it better. It works just like the ContextMenu control. You still attach a ContextMenuStrip control to another user control by changing that control’s ContextMenuStrip property. However, Microsoft has substantially improved the features you can add to a ContextMenuStrip cont...

    Look at the examples at MSDN:

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

    ContextMenuStrip replaces ContextMenu. You can associate a ContextMenuStrip with any control, and a right mouse click automatically displays the shortcut menu. You can show a ContextMenuStrip programmatically by using the Show method. ContextMenuStrip supports cancelable Opening and Closing events to handle dynamic population and multiple-click scenarios. ContextMenuStrip supports images, menu-item check state, text, access keys, shortcuts, and cascading menus.

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

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

提交回复
热议问题