We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Create Palette with GroupNode where GroupNode contain multiple ControlNodes.

Platform: WinForms |
Control: Diagram |
Published Date: May 12, 2017 |
Last Revised Date: May 31, 2019

Create Palette with GroupNode where GroupNode contain multiple ControlNodes.

In diagram control, we can add a group object with contains multiple ControlNode into the symbol palette.

The following codes illustrates to adding the group with multiple ControlNode 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 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 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 group node
            group.AppendChild(textboxCtrlNode);
            group.AppendChild(labelCtrlNode);
 
            diagram1.Model.AppendChild(group);
            
            //adding symbols to 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 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 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 group node
   group.AppendChild(textboxCtrlNode)
   group.AppendChild(labelCtrlNode)
 
   diagram1.Model.AppendChild(group)
 
   'adding symbols to palette
   Dim symbol As New SymbolPalette()
   symbol.AppendChild(group)
 
   paletteGroupBar1.AddPalette(symbol)
 

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon