Ejemplo n.º 1
0
        public void FrmLayout_Load(object sender, EventArgs e)
        {
            button1.changeColor(Color.White, Color.Red);
            button2.changeColor(Color.White, Color.DimGray);
            button3.changeColor(Color.White, Color.DimGray);


            sections = new ArrayList();
            sections.Clear();
            listPanel.Clear();
            DataTable sectionList = serviceGet.getSections("1001");

            for (int i = 0; i < sectionList.Rows.Count; i++)
            {
                string sectionName = sectionList.Rows[i][1].ToString();
                sections.Add(sectionName);
                ArrayList tmp = new ArrayList();
                tmp = serviceGet.getTables("1001", sectionName);

                //Int64 a = (Int64)sectionList.Rows[i][2];
                Color       color1 = Color.FromArgb((int)sectionList.Rows[i][2]);
                Color       color2 = Color.FromArgb((int)sectionList.Rows[i][3]);
                PanelLayout panel  = new PanelLayout(sectionName, tmp, color1, color2, isTransfer);
                listPanel.Add(sectionName, panel);
                this.Controls.Add((PanelLayout)listPanel[sectionName]);
            }
            if (isTransfer)
            {
                button1.Text = "Quay về";
                for (int i = 2; i < 8; i++)
                {
                    var tmp = (button)panel4.Controls["button" + i.ToString()];
                    //tmp.changeColor(Color.White,Color.LightGray);
                    tmp.Enabled = false;
                }
            }


            pageIndex       = 1;
            selectedSection = 0;
            if (listPanel.Count % 4 == 0)
            {
                pageNum = listPanel.Count / 4;
            }
            else
            {
                pageNum = listPanel.Count / 4 + 1;
            }
            for (int i = 10; i < 14; i++)
            {
                var tmp = (button)panel3.Controls["button" + i.ToString()];
                //tmp.changeColor(Color.White,Color.LightGray);
                tmp.Click += new EventHandler(tmp_Click);
            }
            LoadSectionButton();
            var tmppanel = (PanelLayout)listPanel[sections[0].ToString()];

            tmppanel.BringToFront();
            this.Refresh();
        }
Ejemplo n.º 2
0
        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();
        }