Ejemplo n.º 1
0
 private void loadmonnuoc()
 {
     foreach (DataRow row in ma.LayMonAn(1).Rows)
     {
         DTO_MonAn    monan   = new DTO_MonAn(int.Parse(row["mamon"].ToString()), row["tenmon"].ToString(), float.Parse(row["gia"].ToString()), 1, row["hinhanh"].ToString());
         QuanLy_MonAn element = new QuanLy_MonAn(monan);
         this.fLoutMonNuoc.Controls.Add(element);
         element.panel5.Visible = false;
         element.panel3.Visible = false;
         element.panel2.Enabled = false;
         element.panel2.Visible = false;
         element.tbxTen.Enabled = false;
         element.tbxGia.Enabled = false;
         element.panel4.Visible = true;
         element.panel4.Enabled = true;
         element.Size           = new Size(250, 300);
         element.btnDel.Click  += new EventHandler((o, e) => RemoveElement(o, e, fLoutMonAn));
     }
 }
Ejemplo n.º 2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            QuanLy_MonAn element = new QuanLy_MonAn(null)
            {
                PhanLoai = PhanLoai.MonNuoc
            };

            this.fLoutMonNuoc.Controls.Add(element);
            this.fLoutMonNuoc.Controls.SetChildIndex(element, 1);
            element.panel5.Visible = false;
            element.panel3.Visible = false;
            element.panel2.Enabled = false;
            element.panel2.Visible = false;
            element.tbxTen.Enabled = false;
            element.tbxGia.Enabled = false;
            element.panel4.Visible = true;
            element.panel4.Enabled = true;
            element.Size           = new Size(250, 300);
            element.btnDel.Click  += new EventHandler((o, ev) => RemoveElement(o, ev, fLoutMonNuoc));
        }
Ejemplo n.º 3
0
 private void loadmonan()
 {
     foreach (DataRow row in ma.LayMonAn(0).Rows)
     {
         QuanLy_MonAn element = new QuanLy_MonAn();
         element.tbxTen.Text = row["tenmon"].ToString();
         element.tbxGia.Text = row["gia"].ToString();
         Image image = Image.FromFile(row["hinhanh"].ToString());
         element.picture.Image = image;
         this.fLoutMonAn.Controls.Add(element);
         element.Tag            = row["mamon"].ToString();
         element.panel5.Visible = true;
         element.panel3.Visible = true;
         element.panel2.Enabled = false;
         element.panel2.Visible = false;
         element.tbxTen.Enabled = false;
         element.tbxGia.Enabled = false;
         element.panel4.Visible = false;
         element.panel4.Enabled = false;
         element.Size           = new Size(250, 250);
         element.ClickChonMon  += Element_ClickChonMon;
     }
 }