c# - Context menu items and subitems -


I have a context menu inside the form.

For some reason, I wrote context menu together so I wrote this peace code:

  int a = 0; Leading (Menstep 1. Items with Toolstriptyme in reference) {cum. Text = "menu" + A. Toasting (); One ++; }   

But the main items change successfully, but if subitems do not change then how can I access those subitems too?

PS: I can not add one image because I am new to this forum, what I am saying, I hope you will get this idea.

Thank you!

You need to enter ToolStripDropDownItem and DropDownItems property. And, of course, update it again

Here's the sample:

  Public Zero ChangeMenu Name (ToolStripTime Collection Archive) {foreach (Toolstrip in the collectionMost item item) {item .Name = "new name"; If (item is toolstrip dropdown item) {ToolStripDropDownItem dropdown = (ToolStripDropDownItem) item; If (dropdowndown.downupdotts.count> gt; 0) {this.ChangeMenuItemsNames (dropDownItem.DropDownItems); }}}}   

How to use:

  this.ChangeMenuItemsNames (this.contextMenuStrip1.Items);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -