private void button1_Click(object sender, EventArgs e) { Control result = getControl(); if (result != null) { result.Parent = this; result.Location = new Point(0, 0); DragControlInfo dci = result.Tag as DragControlInfo; dci.ParentName = this.Name; } }
private void save(Control ct, ref StringBuilder sb) { foreach (Control item in ct.Controls) { if (item.Tag is DragControlInfo) { DragControlInfo c = item.Tag as DragControlInfo; sb.Append(string.Format("N={0}|P={1},X={2}|Y={3}|W={4}|H={5}|V={6};", c.Name, c.ParentName, c.Location.X, c.Location.Y, c.Size.Width, c.Size.Height, c.Visable)); } } foreach (Control item in ct.Controls) { save(item, ref sb); } }