public virtual void Clear() { #if DEBUG int layoutSuspendCount = Owner.LayoutSuspendCount; #endif Owner.SuspendLayout(); // clear all preferred size caches in the tree - // inherited fonts could go away, etc. CommonProperties.xClearAllPreferredSizeCaches(Owner); try { while (Count != 0) { RemoveAt(Count - 1); } } finally { Owner.ResumeLayout(); #if DEBUG Debug.Assert(Owner.LayoutSuspendCount == layoutSuspendCount, "Suspend/Resume layout mismatch!"); #endif } }