Extending default ContextMenu
-Paul.
There isn't a way to merge the items exactly. The best way I can think of do this would be to create a custom ContextMenuStrip and associate it with the text box. The setting of a ContextMenuStrip supersedes the built in context menu. Anyway, then populate your ContextMenuStrip with custom items and cover edit commands cordoned off with separators. You can then route the edit commands to the corresponding methods on the textbox (Cut, Copy, and Paste). You'll have to do some state (enabled) maintenance as well. This can be done in the Opening event of the ContextMenuStrip by checking for a selection and/or appropriate clipboard contents.
textBox1.ContextMenuStrip = myContextMenuStrip
This is not really useful when you are trying to use visual inheritance and trying to add new items to the contextmenustrip.
Try this :
Create a usercontrol
Add a textbox
add a contextmenustrip
set the textbox's contextmenustrip to the contextmenustrip you just created.
Add "Cut" And "Copy" to this shortcut.
Set the "Modifier" of the contextmenustrip to "public"
Build the project
Create an inherited userControl, and select the above user control as the base control
in the designer you will see the contextmenustrip.
It will even SEEM LIKE you can add new items to the contextmenustrip...
But add the items, SAVE and close the usercontrol design screen...
Re-open it
Your items are in the form, but DETACHED from the contextMenustrip...
Pretty interesting, isn't it ?
PS: This is the published version of VS 2005