public virtual Element CloneElement(Element element) { Element newElement = (Element)element.Clone(); newElement.ActionElement = element; newElement.SetKey(element.Key); newElement.SetModel(element.Model); //Set the action shapes for the complex shape children if (element is ComplexShape) { ComplexShape complex = (ComplexShape)element; ComplexShape newComplex = (ComplexShape)newElement; foreach (Solid solid in newComplex.Children.Values) { solid.ActionElement = complex.Children[solid.Key]; } } //Keep size of table if (element is Table) { Table table = (Table)element; Table newTable = (Table)newElement; newTable.Size = table.Size; } return(newElement); }
//Occurs when an element is added to the elements collection private void Element_Insert(object sender, ElementsEventArgs e) { Element element = e.Value; //Set the layer element.SetLayer(Layer); //Set handlers element.ElementInvalid += new EventHandler(Element_ElementInvalid); //Set the container element.SetModel(Model); CreateRenderList(); OnElementInvalid(); }