/// <summary> /// Adds a <see cref='OpenLiveWriter.Controls.LightweightControl'/> with the specified value to the /// <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> . /// </summary> /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to add.</param> /// <returns>The index at which the new element was inserted.</returns> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.AddRange'/> public int Add(LightweightControl value) { // Add. int index = List.Add(value); // Set the lightweight control container of the lightweight control to the owner of // this lightweight control collection. value.LightweightControlContainerControl = owner; // Force the lightweight control to apply layout logic to child controls. value.PerformLayout(); // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); // Return index. return index; }
/// <summary> /// Inserts a <see cref='OpenLiveWriter.Controls.LightweightControl'/> into the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> at the specified index. /// </summary> /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> /// <param name=' value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to insert.</param> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Add'/> public void Insert(int index, LightweightControl value) { // Insert. List.Insert(index, value); // Set the lightweight control container of the lightweight control to the owner of // this lightweight control collection. value.LightweightControlContainerControl = owner; // Force the lightweight control to apply layout logic to child controls. value.PerformLayout(); // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); }