By Volvick Derose 1 - Monday, October 11, 2010
I created a group manually, but when I delete the group, the ports are still shown on my screen. Is there a way to prevent that from happening? I want when I delete the group for the ports to be deleted as well. What I did, I have a shape with couple of ports, then I group multiple of that shapes. However when I delete the group, the ports are not deleted with the group.
|
By Nevron Support - Monday, October 11, 2010
Hello Volvick, This is a strange behavior, when deleting a group the ports should also be deleted. We were unable to replicate this problem, can you please elaborate and provide us with more details regarding the group you created.
|
By Volvick Derose 1 - Tuesday, October 12, 2010
Here is the code. All you need to do, add two buttons to a form, click on the second one to create the shape then select it and click on the first one button to create the group. The group simply group a shape inside another shape by adding the shape to the group. As you can see, when deleting the group, the ports are still present on the screen. private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e){ NShape firstShape = nDrawingView1.Selection.FirstNode as NShape;NGroup myGroup = new NGroup();NFlowChartingShapesFactory factory = new NFlowChartingShapesFactory(nDrawingDocument1);NShape entityShape = factory.CreateShape(FlowChartingShapes.Process); entityShape.Bounds = new NRectangleF(100, 100, 200, 100);entityShape.Text = "my text";if (firstShape.Name.Contains("Group") == true){ myGroup = nDrawingView1.Selection.AnchorNode as NGroup;NShape myShape = myGroup.Shapes.GetChildAt(0) as NShape;myShape.Width = myShape.Width + 250; int nCount = myGroup.Shapes.ChildrenCount(NFilters.Shape2D);entityShape.Location = new NPointF(firstShape.Location.X + 250 * nCount - 230, firstShape.Location.Y + 20);nDrawingDocument1.ActiveLayer.AddChild(entityShape); myGroup.Shapes.AddChild(entityShape); int numberOfPart = nDrawingView1.Selection.NodesCount;} else if (firstShape.Name.Contains("Group") != true){ myGroup.Shapes.AddChild(firstShape); nDrawingDocument1.ActiveLayer.AddChild(entityShape); firstShape.Width = entityShape.Width + 40; firstShape.Height = entityShape.Height + 40; entityShape.Location = new NPointF(firstShape.Location.X + 20, firstShape.Location.Y + 20);myGroup.Shapes.AddChild(entityShape); } myGroup.UpdateModelBounds(); nDrawingDocument1.ActiveLayer.AddChild(myGroup); nDrawingView1.Selection.DeselectAll(); } private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e){ NFlowChartingShapesFactory factory = new NFlowChartingShapesFactory(nDrawingDocumentProjectModeling);NShape entityShape = factory.CreateShape(FlowChartingShapes.Process);entityShape.Bounds = new NRectangleF(100, 100, 200, 100);entityShape.Text = "my text";nDrawingDocumentProjectModeling.ActiveLayer.AddChild(entityShape); }
|
By Volvick Derose 1 - Wednesday, October 13, 2010
Below I edited the second button, sorry for the typo
private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e)
{
NFlowChartingShapesFactory factory = new NFlowChartingShapesFactory(nDrawingDocument1);
NShape entityShape = factory.CreateShape(FlowChartingShapes.Process);
entityShape.Bounds = new NRectangleF(100, 100, 200, 100);
entityShape.Text = "my text";
nDrawingDocument1.ActiveLayer.AddChild(entityShape);
}
|
|