ToolStripItemCollection.Clear 方法

定义

从集合中移除所有项。Removes all items from the collection.

public:
 virtual void Clear();
public virtual void Clear ();
abstract member Clear : unit -> unit
override this.Clear : unit -> unit
Public Overridable Sub Clear ()

实现

异常

注解

Clear使用方法可从父控件中删除整个控件集合。Use the Clear method to remove the entire collection of controls from a parent control.

若要从集合中移除单个控件, 请使用RemoveRemoveAt方法。To remove an individual control from the collection, use the Remove or RemoveAt method.

若要将ToolStripItem新控件添加ToolStripItemCollection到中, AddAddRange使用或方法。To add new ToolStripItem controls to the ToolStripItemCollection, use the Add or AddRange method.

继承者说明

当在Clear()派生类中重写时, 请确保调用基类的Clear()方法, 以确保从集合中移除所有控件。When overriding Clear() in a derived class, be sure to call the base class's Clear() method to ensure that all the controls are removed from the collection.

适用于