문제

How to remove all DropDownItems from a ToolStripDropDownButton, if its propery is read only?

도움이 되었습니까?

해결책

Use the Clear method:

toolStripDropDownButton1.DropDownItems.Clear();

다른 팁

The DropDownItems property is a collection. See

http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripitemcollection.aspx

Therefore, you can use Remove and RemoveAt to remove items, preferably using a for loop.

In addition, the property is read only in a sense that you can't set it using an operator, but you can modify the contents of the collection.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top