GroupBox - ahatornn/clforms GitHub Wiki
ClForms.Elements.GroupBox
Represents a Windows control that displays a frame around a control with an optional caption
public class GroupBox: SingleContentControl, IElementStyle<GroupBox>Inheritance Control -> ContentControl -> SingleContentControl -> GroupBox
Derived IElementStyle<GroupBox>
The following code example instantiates and creates a GroupBox and panel control. The panel is added to the group box and the group box is added to the Window.
var targetBox = new GroupBox()
{
Background = Color.DarkMagenta,
Text = "Header",
};
var contentPanel = new Panel
{
VerticalContentAlignment = VerticalAlignment.Center,
HorizontalContentAlignment = HorizontalAlignment.Center,
};
contentPanel.AddContent(new Label("Content")
{
Background = Color.Magenta,
Foreground = Color.White,
});
targetBox.AddContent(contentPanel);
AddContent(targetBox);You can find more examples of using the CheckBoxGroup in this project
The GroupBox displays a frame around a group of controls with or without a caption. Use a GroupBox to logically group a collection of controls on a form. The group box is a container control that can be used to define groups of controls.
| Syntax | Description |
|---|---|
| GroupBox() | Initialize a new GroupBox instance |
| Name | Type | Description |
|---|---|---|
| AutoSize | bool | Gets or sets a value indicating whether the control is resized in accordance with its contents |
| Background | Color | Gets or sets a brush that describes the background of a control |
| BackgroundIsTransparent | bool | Gets a value indicating whether the Background has Color.NotSet
|
| BorderChars | BorderChars | Gets or sets the BorderChars that draws the border characters |
| BorderColor | Color | Gets or sets the Color that draws the border color |
| BorderThickness | Thickness | Gets or sets the relative frame Thickness of a GroupBox |
| Bounds | Rect | Gets the size and location of the control including its nonclient elements, in points, relative to the parent control |
| Content | Control | Child control |
| DesiredSize | Size | Gets the size that this element computed during the measure pass of the layout process |
| DrawingContext | IDrawingContext | Gets a value of the drawing context |
| Foreground | Color | Gets or sets a brush that describes the text of a control |
| ForegroundIsTransparent | bool | Gets a value indicating whether the Foreground has Color.NotSet
|
| Height | int? | Gets or sets the height of the control |
| Id | long | Gets a value of the control's identifier |
| IsMeasureValid | bool | Gets a value indicating whether component sizing was performed |
| IsVisualValid | bool | Gets a value indicating whether the component is being re-rendered |
| Location | Point | Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container |
| Margin | Thickness | Gets or sets the outer margin of an element |
| Padding | Thickness | Gets or sets a Thickness value that describes the amount of space between a control and its child element |
| Parent | ContentControl | Gets or sets the parent container of the control |
| Tag | object | Gets or sets the object that contains data about the control |
| Text | string | Gets or sets the text associated with this control |
| TextAlignment | TextAlignment | Gets or sets the horizontal alignment of the text associated with this control |
| Width | int? | Gets or sets the width of the control |
| Syntax | Description |
|---|---|
| AddContent(Control content) | Adds the specified control to the control collection |
| Arrange(Rect) | Positions child elements and determines a size for a Control. Parent elements call this method from their Arrange(Rect) implementation to form a recursive layout update |
| InvalidateMeasure() | Invalidates the measurement state (layout) for the element |
| InvalidateMeasureIfAutoSize() | Invalidates the measurement state (layout) for the element if AutoSize property is true otherwise invalidates the rendering of the element |
| InvalidateVisual() | Invalidates the rendering of the element, and forces a complete new layout pass. OnRender(IDrawingContext) is called after the layout cycle is completed |
| Measure(Size) | Updates DesiredSize of a Control. Parent elements call this method from their own Measure(Size) implementations to form a recursive layout update |
| OnRender(IDrawingContext) | Filling a pseudographics drawing context |
| ParentWindow() | Gets the form the control is in |
| RemoveContent(Control content) | Remove the specified control to the control collection |
| SetStyle(Action) | Defines actions with an element style |
| Event | Description |
|---|---|
| OnAutoSizeChanged | Occurs when the value of the AutoSize property changes |
| OnBackgroundChanged | Occurs when the value of the Background property changes |
| OnBorderCharsChanged | Occurs when the value of the BorderChars property changes |
| OnBorderColorChanged | Occurs when the value of the BorderColor property changes |
| OnBorderThicknessChanged | Occurs when the value of the BorderThickness property changes |
| OnForegroundChanged | Occurs when the value of the Foreground property changes |
| OnHeightChanged | Occurs when the value of the Height property changes |
| OnMarginChanged | Occurs when the value of the Margin property changes |
| OnPaddingChanged | Occurs when the value of the Padding property changes |
| OnParentChanged | Occurs when the value of the Parent property changes |
| OnTagChanged | Occurs when the value of the Tag property changes |
| OnTextAlignmentChanged | Occurs when the value of the TextAlignment property changes |
| OnTextChanged | Occurs when the value of the Text property changes |
| OnWidthChanged | Occurs when the value of the Width property changes |