/// <summary> /// 动态加载配置页 /// </summary> /// <param name="tableName">表名</param> /// <param name="displayName">显示名称</param> /// <returns></returns> private ConfigPageData LoadTabPage(ConfigDefine config) { string tableName = config.TableName; string displayName = config.TableDisplayName; //动态创建控件 CheckedListBoxControl list = new CheckedListBoxControl(); list.Dock = System.Windows.Forms.DockStyle.Fill; list.Location = new System.Drawing.Point(0, 0); list.Name = "list" + tableName; list.Size = new System.Drawing.Size(293, 270); list.Font = new Font("Courier New", 10); //动态创建控件 ConfigPageData page = new ConfigPageData(tableName, list); page.Name = "page" + tableName; page.Size = new System.Drawing.Size(293, 270); page.Text = displayName; page.Controls.Add(list); this.xtraTabControl1.TabPages.Add(page); return(page); }
//初始化界面 private void InitUI(IList configDefList, string windowName) { try { this.SuspendLayout(); xtraTabControl1.TabPages.Clear();//清空 if (configDefList != null) { foreach (ConfigDefine def in configDefList) { ConfigPageData page = this.LoadTabPage(def); page.DoLoadData(); //显示数据 } } } finally { this.ResumeLayout(); } }