Create Palette with GroupNode where GroupNode contain multiple ControlNodes.
Create Palette with GroupNode where GroupNode contains multiple ControlNodes.
In the diagram control, we can add a group object that contains multiple ControlNodes into the symbol palette.
The following code illustrates adding the group with multiple ControlNodes to the palette.
[C#]
// Initializing the label control
System.Windows.Forms.Label label = new System.Windows.Forms.Label();
label.Size = new System.Drawing.Size(200, 25);
label.Text = "Label";
label.Name = "Label";
label.TextAlign = ContentAlignment.MiddleCenter;
// Initializing the textbox control
TextBox textbox = new TextBox();
textbox.MinimumSize = new System.Drawing.Size(200, 400);
textbox.Text = "TextBox";
textbox.Name = "TextBox";
// Adding a textbox to the diagram's control node
ControlNode textboxCtrlNode = new ControlNode(textbox, new RectangleF(0, 0, 200, 100));
textboxCtrlNode.Name = "TextBoxControl";
textboxCtrlNode.ActivateStyle = ActivateStyle.ClickPassThrough;
// Adding a label to the diagram's control node
ControlNode labelCtrlNode = new ControlNode(label, new RectangleF(0, 100, 200, 25));
labelCtrlNode.ActivateStyle = ActivateStyle.ClickPassThrough;
labelCtrlNode.Name = "LabelControl";
Group group = new Group();
group.Name = "GroupNode";
// Adding symbols to the group node
group.AppendChild(textboxCtrlNode);
group.AppendChild(labelCtrlNode);
diagram1.Model.AppendChild(group);
// Adding symbols to the palette
SymbolPalette symbol = new SymbolPalette();
symbol.AppendChild(group);
paletteGroupBar1.AddPalette(symbol);
[VB]
' Initializing the label control
Dim label As New System.Windows.Forms.Label()
label.Size = New System.Drawing.Size(200, 25)
label.Text = "Label"
label.Name = "Label"
label.TextAlign = ContentAlignment.MiddleCenter
' Initializing the textbox control
Dim textbox As New TextBox()
textbox.MinimumSize = New System.Drawing.Size(200, 400)
textbox.Text = "TextBox"
textbox.Name = "TextBox"
' Adding a textbox to the diagram's control node
Dim textboxCtrlNode As New ControlNode(textbox, New RectangleF(0, 0, 200, 100))
textboxCtrlNode.Name = "TextBoxControl"
textboxCtrlNode.ActivateStyle = ActivateStyle.ClickPassThrough
' Adding a label to the diagram's control node
Dim labelCtrlNode As New ControlNode(label, New RectangleF(0, 100, 200, 25))
labelCtrlNode.ActivateStyle = ActivateStyle.ClickPassThrough
labelCtrlNode.Name = "LabelControl"
Dim group As New Group()
group.Name = "GroupNode"
' Adding symbols to the group node
group.AppendChild(textboxCtrlNode)
group.AppendChild(labelCtrlNode)
diagram1.Model.AppendChild(group)
' Adding symbols to the palette
Dim symbol As New SymbolPalette()
symbol.AppendChild(group)
paletteGroupBar1.AddPalette(symbol)
Conclusion
I hope you enjoyed learning about Create Palette with GroupNode where GroupNode contain multiple ControlNodes..
You can refer to WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to SyncfusionĀ®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!