By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

build context menu from menu strip

P: n/a
Hi,

I build the menu strip using the designer.I want the context menu of
the form to be same as the of children of one of the top leven Menu
strip item.
Items["actionToolStripMenuItem"] gives me a ToolStripItem object but
it does not have a hierarchy, no parents no children.

How do i do this in c#?

I tried

this.ContextMenuStrip.Items.AddRange(Menu.Items.Fi nd("actionToolStripMenuItem",true));

but that line removes it from the menustrip and adds it to context
menu

TIA
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
parez,

Well, you can always create a new instance of the menu item, and then
add it to the context menu. Also, the menu item should have an Items
property which represents the children menu items on a sub menu.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"parez" <ps*****@gmail.comwrote in message
news:d7**********************************@a70g2000 hsh.googlegroups.com...
Hi,

I build the menu strip using the designer.I want the context menu of
the form to be same as the of children of one of the top leven Menu
strip item.
Items["actionToolStripMenuItem"] gives me a ToolStripItem object but
it does not have a hierarchy, no parents no children.

How do i do this in c#?

I tried

this.ContextMenuStrip.Items.AddRange(Menu.Items.Fi nd("actionToolStripMenuItem",true));

but that line removes it from the menustrip and adds it to context
menu

TIA

Jun 27 '08 #2

P: n/a
On Jun 2, 12:24 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
parez,

Well, you can always create a new instance of the menu item, and then
add it to the context menu. Also, the menu item should have an Items
property which represents the children menu items on a sub menu.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"parez" <psaw...@gmail.comwrote in message

news:d7**********************************@a70g2000 hsh.googlegroups.com...
Hi,
I build the menu strip using the designer.I want the context menu of
the form to be same as the of children of one of the top leven Menu
strip item.
Items["actionToolStripMenuItem"] gives me a ToolStripItem object but
it does not have a hierarchy, no parents no children.
How do i do this in c#?
I tried
this.ContextMenuStrip.Items.AddRange(Menu.Items.Fi nd("actionToolStripMenuItem",true));
but that line removes it from the menustrip and adds it to context
menu
TIA

ToolStripItem actionItem = Menu.Items["actionToolStripMenuItem"];

actionItem does not have Items property.

Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.