private void Form2_Load(object sender, EventArgs e) { fc = new FormControl(this); fc.GetInit(this, fc); this.formStartX = this.Width; this.formStartY = this.Height; }
/// <summary> /// 记录所有初始值 /// </summary> /// <param name="cons"></param> /// <param name="paraent"></param> public void GetInit(Control cons, FormControl paraent) { if (cons.Controls.Count > 0) { foreach (Control con in cons.Controls) { con.Anchor = AnchorStyles.Left | AnchorStyles.Top; FormControl fc = new FormControl(con); fc.GetInit(con, fc); paraent.Child.Add(fc); } } else { return; } }