Ejemplo n.º 1
0
        private void LoadDanhMucBan()
        {
            int width  = 130;
            int height = 100;

            foreach (var item in b.getDSTatCaBan())
            {
                Button btnDM = new Button();
                btnDM.Width                 = width;
                btnDM.Height                = height;
                btnDM.Text                  = item.TENBAN;
                btnDM.Cursor                = Cursors.Hand;
                btnDM.Dock                  = DockStyle.Top;
                btnDM.TextAlign             = ContentAlignment.BottomCenter;
                btnDM.BackgroundImage       = Properties.Resources.table_64px;
                btnDM.BackgroundImageLayout = ImageLayout.Center;
                btnDM.Tag = item;

                pnlDMBan.Controls.Add(btnDM);
                if (hd.KTraBan(item.MABAN) == true)
                {
                    btnDM.BackColor = Color.LightSlateGray;
                }
                else
                {
                    btnDM.BackColor = Color.Red;
                }
                btnDM.Click += btnDM_Click;
            }
        }