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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I progammatically add a symbol from the palette?

Platform: WinForms |
Control: Diagram

How can I progammatically add a symbol from the palette?

The following code sample demonstrates how you can progamatically add a symbol from the symbol palette to a Diagram.


//New InsertNodesCmd InsertNodesCmd insCmd = new InsertNodesCmd();
//Select the Symbol from the PaletteGroupView this.paletteGroupView1.SelectSymbolModel(this.paletteGroupView1.GroupViewItems[1].Text); SymbolModel symModel = this.paletteGroupView1.SelectedSymbolModel;
//New NodeCollection NodeCollection nodes = new NodeCollection();
//Add Symbol to the NodeCollection if (symModel != null) {  Symbol triangle = symModel.CreateSymbol();  nodes.Add(triangle);
} insCmd.Nodes.Concat(nodes); insCmd.Location = new PointF(125,125); //ExecuteCommand to add the Symbol this.diagram1.Controller.ExecuteCommand(insCmd);



'New InsertNodesCmd Dim insCmd As New InsertNodesCmd()
'Select the Triangle from the PaletteGroupView Me.paletteGroupView1.SelectSymbolModel(Me.paletteGroupView1.GroupViewItems(1).Text) Dim symModel As SymbolModel = Me.paletteGroupView1.SelectedSymbolModel 'new NodeCollection Dim nodes As New NodeCollection() 'Add Symbol to the NodeCollection If Not (symModel Is Nothing) Then     Dim triangle As Symbol = symModel.CreateSymbol()     nodes.Add(triangle) End If insCmd.Nodes.Concat(nodes) insCmd.Location = New PointF(125, 125) 'Execute the InsertNodesCmd Me.diagram1.Controller.ExecuteCommand(insCmd)


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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.

Up arrow icon

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

Live Chat Icon For mobile