예제 #1
0
        private void ThemBan_Load(object sender, EventArgs e)
        {
            DataTable dt    = bll.getDanhSachBan();
            int       index = dt.Rows.Count + 1;

            textBox1.Text = "Bàn " + index.ToString();
        }
예제 #2
0
        public void loadPanle(SplitContainer splitContainer1)
        {
            DataTable dt = bll.getDanhSachBan();

            int x = 0;

            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                x = i;

                Button button = new Button();

                CheckBox checkBox = new CheckBox();
                button.Text        = "Bàn " + i.ToString();
                button.Name        = i.ToString();
                button.Image       = Image.FromFile(Path + @"\Images\bandoi.jpg");
                checkBox.Image     = Image.FromFile(Path + @"\Images\bandoi.jpg");
                button.TextAlign   = ContentAlignment.TopCenter;
                checkBox.TextAlign = ContentAlignment.TopCenter;
                checkBox.Text      = "Bàn " + i.ToString();
                checkBox.Name      = i.ToString();

                button.Size = new Size(150, 100);

                checkBox.Size       = new Size(150, 100);
                checkBox.Appearance = Appearance.Button;

                if (i % 3 == 1)
                {
                    //button.Location = new Point(37,50*i);
                    button.Left = 0;

                    button.Top = 40 * x;

                    checkBox.Left = 0;
                    checkBox.Top  = 40 * x;

                    splitContainer1.Panel1.Controls.Add(button);
                    splitContainer1.Panel2.Controls.Add(checkBox);
                    button.Click += new EventHandler(this.button_Click);
                }
                if (i % 3 == 2)
                {
                    //button.Location = new Point(290, 50  * i-(i-1)*50);
                    button.Left   = 150;
                    button.Top    = 40 * (x - 1);
                    checkBox.Left = 150;
                    checkBox.Top  = 40 * (x - 1);


                    splitContainer1.Panel2.Controls.Add(checkBox);
                    splitContainer1.Panel1.Controls.Add(button);
                    button.Click += new EventHandler(this.button_Click);
                }
                if (i % 3 == 0)
                {
                    //button.Location = new Point(290, 50  * i-(i-1)*50);
                    button.Left   = 300;
                    button.Top    = 40 * (x - 2);
                    checkBox.Left = 300;
                    checkBox.Top  = 40 * (x - 2);


                    splitContainer1.Panel2.Controls.Add(checkBox);
                    splitContainer1.Panel1.Controls.Add(button);
                    button.Click += new EventHandler(this.button_Click);
                }
            }
        }