private objCl initPanelContentAddcl(objCl o) { //throw new NotImplementedException(); Stopwatch tmpWatch = new Stopwatch(); try { tmpWatch.Start(); this.SuspendLayout(); _objcl2 = (objCl)o; _lstContr2 = new Control[o.gwNum + o.UserPersonNum + o.UserNullNum]; //this.Text = "人员揭示:开始初始化控-->关位:" + o.gwNum + "个"; //************todo something //关位 _objcl2.u_gwNum = 0; for (int i = 0; i < o.gwNum; i++) { UserPersonsList tmpd = new UserPersonsList(); tmpd.Visible = false; tmpd.GuanweiID = i.ToString(); tmpd.RealCount = i; tmpd.StandardCount = i; //tmpd.Left = (i % 14) * tmpd.Width; //tmpd.Top = (i % 10) * tmpd.Height; _lstContr2[i] = tmpd; } //人员 //this.Text = "人员揭示:初始化控-->关位:" + o.gwNum + ",已完成.开始人员控件:" + o.UserPersonNum + "个"; _objcl2.u_UserPersonNum = o.gwNum; for (int i = o.gwNum; i < (o.gwNum + o.UserPersonNum); i++) { UserPerson tmpd = new UserPerson(); tmpd.Visible = false; tmpd.UserID = i.ToString(); tmpd.UserName = "******" + i.ToString(); //tmpd.Left = (i % 14) * tmpd.Width; //tmpd.Top = (i % 10) * tmpd.Height; _lstContr2[i] = tmpd; } //空位 //this.Text = "人员揭示:初始化控-->关位:" + o.gwNum + ",人员:" + o.UserPersonNum + ",已完成.开始空位人员控件:" + o.UserNullNum + "个"; var tmpi = o.gwNum + o.UserPersonNum; _objcl2.u_UserNullNum = tmpi; for (int i = tmpi; i < (o.gwNum + o.UserPersonNum + o.UserNullNum); i++) { UserPersonNull tmpd = new UserPersonNull(); tmpd.Visible = false; tmpd.UserID = i.ToString(); tmpd.UserName = "******" + i.ToString(); //tmpd.Left = (i % 14) * tmpd.Width; //tmpd.Top = (i % 10) * tmpd.Height; _lstContr2[i] = tmpd; } //************end todo o.cl.Controls.AddRange(_lstContr2); this.ResumeLayout(false); this.PerformLayout(); tmpWatch.Stop(); var msg = "人员调换:初始化控件,关位:" + o.gwNum + ",人员:" + o.UserPersonNum + ",空位:" + o.UserNullNum + ",Time:" + tmpWatch.Elapsed.ToString(); Program.logFlagStart(log, tmpWatch, msg); return o; } catch (Exception ex) { return null; throw; } }
public void initCl() { try { _oldUsedObj = new objCl() { u_gwNum = 0, u_UserNullNum = 0, u_UserPersonNum = 0, gwNum = 0, UserNullNum = 0, UserPersonNum = 0 }; _objcl2 = new objCl() { cl = panelContent, gwNum = 30, UserPersonNum = 80, UserNullNum = 70 }; initPanelContentAddcl(_objcl2); } catch (Exception ex) { XtraMsgBox.Show("画面初始化失败!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error, ex, this.GetType()); } }