Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have one contextmenustrip control associated with treenode. I have created one menu item in contextmenustrip manually in the form itself(for example named as "Assign").

Now I want to add sub menu items whenever user clicks this Assign item, it will create a list of users name as a sub menu item with checked or unchecked option.

For example, once user clicked Assign then I want to show the user name dynamically.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
261 views
Welcome To Ask or Share your Answers For Others

1 Answer

To add an item, you would call

myContextMenuStrip.Items.Add("Item title", null, myClickHandler);

To add a sub-menu, you take an existing item and do the same to it:

(myContextMenuStrip.Items[0] as ToolStripMenuItem).DropDownItems.Add(...)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...