User Interface > Widgets > Containers > Group Box |
The group box is represented by the NGroupBox class. It is a widget that consists of 2 child widgets – Header and Content. Here’s an example of a group box that contains a button:
This group box was created with the following code:
Simple Group Box Example |
Copy Code
|
---|---|
NButton button = new NButton("Button in a group box"); NGroupBox groupBox = new NGroupBox("Group Box 1", button); |
You can also change the placement of the header and add more widgets by first placing them in a panel:
This group box was created with the following code:
Group Box with Centered Header Example |
Copy Code
|
---|---|
NGroupBox groupBox2 = new NGroupBox("Group Box 2 - Centered Header"); groupBox2.Header.HorizontalPlacement = ENHorizontalPlacement.Center; m_ContentPanel.Add(groupBox2); NStackPanel stack = new NStackPanel(); groupBox2.Content = stack; stack.Add(new NLabel("Label 1 in stack")); stack.Add(new NLabel("Label 2 in stack")); stack.Add(new NLabel("Label 3 in stack")); |