示例#1
0
        public void LoadBan(string viTri)
        {
            int width  = 90;
            int height = 60;

            foreach (var item in bllBanHang.LoadBanTheoTang(viTri))
            {
                Button btnBan = new Button();
                btnBan.Width     = width;
                btnBan.Height    = height;
                btnBan.Cursor    = Cursors.Hand;
                btnBan.FlatStyle = FlatStyle.Flat;
                btnBan.FlatAppearance.BorderSize = 0;
                btnBan.Font      = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                btnBan.ForeColor = Color.Gainsboro;

                btnBan.Text = item.TenBan.ToString();
                btnBan.Name = item.MaBan.ToString();

                if (item.TrangThai == "Trống")
                {
                    btnBan.BackColor = Color.DarkGreen;
                }
                else
                {
                    btnBan.BackColor = Color.FromArgb(255, 87, 34);
                }

                btnBan.Click += btnBan_Click;
                fpnlBan.Controls.Add(btnBan);
            }
        }