protected override object CloneMe() { IEnumerator enumerator = null; GroupElement Parent = (GroupElement)base.CloneMe(); Parent.mElements = new ArrayList(); try { foreach (object mElement in this.mElements) { BaseElement Element = ((BaseElement)RuntimeHelpers.GetObjectValue(mElement)).Clone(); Parent.mElements.Add(Element); Parent.AttachEvents(Element); Element.Reparent(Parent); } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } return(Parent); }
public virtual void AddElement(BaseElement e) { if (_Elements.Contains(e)) { return; } if (!_IsBaseWindow) { Rectangle rectangle; if (_Elements.Count == 0) { rectangle = e.Bounds; } else { rectangle = Rectangle.Union(Bounds, e.Bounds); if (X != rectangle.X | Y != rectangle.Y) { var dx = X - rectangle.X; var dy = Y - rectangle.Y; foreach (var mElement in _Elements) { var objectValue = (BaseElement)RuntimeHelpers.GetObjectValue(mElement); var location = objectValue.Location; location.Offset(dx, dy); objectValue.Location = location; } } } Location = rectangle.Location; _Size = rectangle.Size; var location1 = e.Location; location1.X -= rectangle.Location.X; location1.Y -= rectangle.Location.Y; e.Location = location1; } _Elements.Add(e); e.Reparent(this); AttachEvents(e); }
public virtual void AddElement(BaseElement e) { if (this.mElements.Contains(e)) { return; } if (!this.mIsBaseWindow) { Rectangle rectangle; if (this.mElements.Count == 0) { rectangle = e.Bounds; } else { rectangle = Rectangle.Union(this.Bounds, e.Bounds); if (this.X != rectangle.X | this.Y != rectangle.Y) { IEnumerator enumerator = null; int dx = this.X - rectangle.X; int dy = this.Y - rectangle.Y; try { foreach (object mElement in this.mElements) { BaseElement objectValue = (BaseElement)RuntimeHelpers.GetObjectValue(mElement); Point location = objectValue.Location; location.Offset(dx, dy); objectValue.Location = location; } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } } } this.Location = rectangle.Location; this.mSize = rectangle.Size; Point location1 = e.Location; location1.X -= rectangle.Location.X; location1.Y -= rectangle.Location.Y; e.Location = location1; } this.mElements.Add(e); e.Reparent(this); this.AttachEvents(e); }