Answer the question
In order to leave comments, you need to log in
How to loop through contextmenustrip (items collection) and change them in c#?
Good afternoon!
Connoisseurs, please tell me how you can iterate over the elements of the contextmenustrip.items collection, if this collection has two types "ToolStripMenuItem", "ToolStripSeparator"?
At the same time, you need to reset the picture for certain elements according to the condition ...
I tried like this, but I can't change the element.
foreach (var subItem in contextMenuForm.Items)
{
if (subItem != e.ClickedItem)
{
//subItem.Image = null;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question