Class ControlSet<T>
Represents a collection of controls of a specified type, providing batch operations and layout utilities for managing and configuring multiple controls as a group.
public class ControlSet<T> : BaseObject, IBaseObject where T : AbstractControl
Type Parameters
TThe type of controls contained in the set. Must derive from AbstractControl.
- Inheritance
-
ControlSet<T>
- Implements
- Derived
- Extension Methods
Remarks
The ControlSet{T} class enables collective manipulation of multiple controls, such as setting properties, handling layout, and responding to events. It is designed to simplify bulk operations and ensure consistency across related controls. Many methods return the current instance to support fluent call chaining. Some operations require the contained controls to implement specific interfaces, such as IControlAndLabel, for certain features to be available.
Constructors
- ControlSet(IEnumerable<T>)
Initializes a new instance of the ControlSet class.
- ControlSet(IReadOnlyList<T>)
Initializes a new instance of the ControlSet class.
- ControlSet(params T[])
Initializes a new instance of the ControlSet class.
Properties
- InnerMaxWidth
Gets the maximum inner control width among all controls in the set.
- this[int]
Gets or sets the element at the specified index.
- Items
Gets all controls which will be affected by the group operations.
- LabelMaxWidth
Gets the maximum inner label width among all controls in the set. Control must implement IControlAndLabel interface in order to allow this method to work.
- MaxHeight
Gets the maximum height among all controls in the set.
- MaxPreferredHeight
Gets the maximum preferred height among all controls in the set.
- MaxPreferredSize
Gets the maximum preferred size among all controls in the set. GetPreferredSize() is called for each control to determine its preferred size, and the maximum width and height are returned as a Size(SizeD) object.
- MaxPreferredWidth
Gets the maximum preferred width among all controls in the set.
- MaxSize
Gets the largest size among all items in the collection.
- MaxWidth
Gets the maximum width among all controls in the set.
Methods
- Action(Action<T>)
Executes specified action for all the controls in the set.
- Action<TItem>(Action<TItem>)
Executes specified action for all the controls in the set.
- BackgroundColor(Color?)
Sets background color for all the controls in the set.
- DoInsideLayout(Action)
Executes
actionbetween calls to SuspendLayout() and ResumeLayout().
- Enabled(bool)
Sets Enabled property for all the controls in the set.
- Enabled(int, bool)
Sets Enabled property for the specified control in the set.
- Font(Font?)
Sets font for all the controls in the set.
- ForEach(Action<T>)
Executes the specified
actionon every AbstractControl in the current collection, regardless of visibility.
- ForEachVisible(Action<T>)
Executes the specified
actionon each visible AbstractControl contained in the current collection.
- ForegroundColor(Color?)
Sets background color for all the controls in the set.
- GroupName(string?)
Sets group name for all the controls in the set.
- HorizontalAlignment(HorizontalAlignment)
Sets horizontal alignment for all the controls in the set.
- InnerSuggestedWidth(float)
Sets SuggestedWidth property for the main child of all the controls in the set. Control must implement IControlAndLabel interface in order to allow this method to work.
- InnerSuggestedWidthToMax()
Sets suggested width for inner children of the controls in the set.
- IsBold(bool)
Sets IsBold for all the controls in the set.
- ItemsOfType<TItem>()
Gets all controls in the set which are of the specified type
T.
- LabelSuggestedWidth(float)
Sets SuggestedWidth property for the inner labels of all controls in the set. Control must implement IControlAndLabel interface in order to allow this method to work.
- LabelSuggestedWidthToMax()
Sets suggested width for all the controls in the set.
- Margin(Thickness)
Sets Margin property for all the controls in the set.
- Margin(float, float, float, float)
Sets Margin property for all the controls in the set.
- MarginBottom(float)
Sets MarginBottom property for all the controls in the set.
- MarginLeft(float)
Sets MarginLeft property for all the controls in the set.
- MarginRight(float)
Sets MarginRight property for all the controls in the set.
- MarginTop(float)
Sets MarginTop property for all the controls in the set.
- MaxHeightOnSizeChanged()
Binds the SizeChanged events of all items in the ControlSet to automatically update the suggested height based on the current maximum height value.
- MaxSizeOnChanged()
Registers a handler for the control's size change event to update the suggested size according to the maximum size constraints.
- MaxWidthOnSizeChanged()
Binds the SizeChanged events of all items in the ControlSet to automatically update the suggested width based on the current maximum width value.
- MinHeight(float)
Sets MinHeight property for all the controls in the set.
- MinSize(SizeD)
Sets MinimumSize property for all the controls in the set.
- MinWidth(float)
Sets MinWidth property for all the controls in the set.
- MinWidthToMaxPreferred()
Sets minimum width for all the controls to the maximum preferred size in the set.
- Padding(Thickness)
Sets Padding property for all the controls in the set.
- Padding(float, float, float, float)
Sets Padding property for all the controls in the set.
- PaddingBottom(float)
Sets PaddingBottom property for all the controls in the set.
- PaddingLeft(float)
Sets PaddingLeft property for all the controls in the set.
- PaddingRight(float)
Sets PaddingRight property for all the controls in the set.
- PaddingTop(float)
Sets PaddingTop property for all the controls in the set.
- Parent(AbstractControl?)
Sets Parent property for all the controls in the set.
- ParentBackColor(bool)
Sets ParentBackColor property for all the controls in the set.
- ParentForeColor(bool)
Sets ParentForeColor property for all the controls in the set.
- ResumeLayout()
Calls SuspendLayout() for all parents of the controls in the set.
- SetUseTheme(KnownTheme)
Sets the theme for all SpeedButton controls
- Size(SizeD)
Sets Size property for all the controls in the set.
- SizeChanged(EventHandler)
Registers an event handler to be invoked when the size of any item in the control set changes.
- SuggestedHeight(float)
Sets the suggested height for all the controls in the set.
- SuggestedHeightToMax()
Sets suggested height for all the controls to the max value in the set.
- SuggestedSize(SizeD)
Sets the suggested size for each item in the control set to the specified value.
- SuggestedWidth(float)
Sets the suggested width for all the controls in the set.
- SuggestedWidthToMax()
Sets suggested width for all the controls to the max value in the set.
- SuspendLayout()
Calls SuspendLayout() for all parents of the controls in the set.
- VerticalAlignment(VerticalAlignment)
Sets vertical alignment for all the controls in the set.
- Visible(bool)
Sets Visible property for all the controls in the set.
- WhenCheckedChanged(EventHandler)
Adds event handler to 'CheckedChanged' event.
- Width(float)
Sets the width for all the controls in the set.
- WidthToMax()
Sets suggested width for all the controls to the max value in the set.