Ejemplo n.º 1
0
        private void model1_ElementClick(object sender, System.EventArgs e)
        {
            //Check that the sender is shape
            if (sender is Shape)
            {
                Shape shape = (Shape)sender;

                //Create a navigate object and set the lines and shapes
                Navigate navigate = new Navigate();

                navigate.Lines  = model1.Lines;
                navigate.Shapes = model1.Shapes;

                //Set the starting shape
                navigate.Start = shape;

                //Return all the children at any level for the shape clicked
                Elements elements = navigate.AllChildren();

                //Select all the children of the shape that was clicked
                foreach (Element element in elements.Values)
                {
                    if (element is ISelectable)
                    {
                        ISelectable selectable = (ISelectable)element;
                        selectable.Selected = true;
                    }
                }
            }
        }