TableLayoutStyleCollection.Clear 方法


断开集合与关联的 TableLayoutPanel 之间的关联,并清空该集合。Disassociates the collection from its associated TableLayoutPanel and empties the collection.

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



不能重写此方法。This method cannot be overridden.

Clear 方法执行两个主要操作:The Clear method performs two main actions:

  • 它将当前的 TableLayoutStyleCollection 与其 TableLayoutPanel 的容器断开,以便样式不再应用于面板中包含的控件的布局。It disassociates the current TableLayoutStyleCollection from its TableLayoutPanel container so that the styles are no longer applied to the layout of the controls contained within the panel. 因此,表布局将重新应用到面板中的所有控件。As a result, the table layout is reapplied to all the controls in the panel.

  • 它将清空其所有 TableLayoutStyle 对象的集合。It empties the collection of all of its TableLayoutStyle objects. 因此,Count 属性设置为0。As a result, the Count property is set to 0.