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

Symbols from palettes

Hi, I need to be able to programatically add a symbol from a palette to a diagram. I can do it using the GetChildByName method, but I cannot for the life of me work out how I can control the size of the symbol added. I am sure I am missing a very simple step. Kind regards Simon

1 Reply

AD Administrator Syncfusion Team September 2, 2004 05:36 PM UTC

Hi Simon Here is a sample demonstrating what you are looking for. In this sample, the Triangle symbol from the Palette is added when you run the application. The symbol is resized by changing it''s bounds. Here is the code snippet from the Form''s Load: //New InsertNodesCmd InsertNodesCmd insCmd = new InsertNodesCmd(); //Select the Triangle 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(); //Set Size triangle.Bounds = new RectangleF(100,100,200,200); nodes.Add(triangle); } insCmd.Nodes.Concat(nodes); insCmd.Location = new Point(125,125); //Execute the InsertNodesCmd this.diagram1.Controller.ExecuteCommand(insCmd); Regards Arun

Live Chat Icon For mobile
Up arrow icon