private void FrmEditLayout_Load(object sender, EventArgs e) { //ArrayList a = new ArrayList(); //a.Add(new MyButton(100,100,50,50)); //ArrayList b = new ArrayList(); //b.Add(new MyButton(200, 200, 100, 100)); //ArrayList c = new ArrayList(); //c.Add(new MyButton(200, 200, 100, 100)); //ArrayList d = new ArrayList(); //d.Add(new MyButton(200, 200, 100, 100)); //ArrayList f = new ArrayList(); //f.Add(new MyButton(200, 200, 100, 100)); //listPanel.Add("khu 1", new panel("khu 1")); //listPanel.Add("khu 2", new panel(b, "khu 2")); //listPanel.Add("khu 3", new panel(c, "khu 3")); //listPanel.Add("khu 4", new panel(d, "khu 4")); //listPanel.Add("khu 5", new panel(f, "khu 5")); //sections.Add("khu 1"); //sections.Add("khu 2"); //sections.Add("khu 3"); //sections.Add("khu 4"); //sections.Add("khu 5"); //this.Controls.Add((panel)listPanel["khu 1"]); //this.Controls.Add((panel)listPanel["khu 2"]); //this.Controls.Add((panel)listPanel["khu 3"]); //this.Controls.Add((panel)listPanel["khu 4"]); //this.Controls.Add((panel)listPanel["khu 5"]); serviceGet = new ServiceGet(); DataTable sectionList = serviceGet.getSections("1001"); for (int i = 0; i < sectionList.Rows.Count; i++) { string sectionName = sectionList.Rows[i][1].ToString(); ArrayList buttons = serviceGet.getTablesEdit("1001", sectionName); Color color1 = Color.FromArgb((int)sectionList.Rows[i][2]); Color color2 = Color.FromArgb((int)sectionList.Rows[i][3]); listPanel.Add(sectionName, new panel(buttons, sectionName, color1, color2)); sections.Add(sectionName); if (buttons.Count != 0) { ((panel)listPanel[sectionName]).colorBar3.color_prop = ((MyButton)buttons[0]).borColor; } this.Controls.Add((panel)listPanel[sectionName]); } button10.changeColor(Color.White, Color.Red); pageIndex = 1; selectedSection = 1; if (listPanel.Count % 4 == 0) { pageNum = listPanel.Count / 4; } else { pageNum = listPanel.Count / 4 + 1; } int x; if (pageIndex * 4 <= listPanel.Count) { x = 4; } else { x = listPanel.Count % 4; } changeColorButton(x); checkInvisible(); }