private void suathongtindonnhap_Click(object sender, EventArgs e) { HidePanels(); menuStrip1.Visible = true; danhsachdonnhappn.Visible = true; nhaphangbus nhbus = new nhaphangbus(); danhsachdonnhapdgv.DataSource = nhbus.listnhaphang(); }
private void taodonnhapluu_Click(object sender, EventArgs e) { nhaphangdto nhdto = new nhaphangdto(); nhdto.Manhaphang = manhapkhotxt.Text; nhdto.Ngaynhaphang = ngaynhapkho.Value.Date.ToShortDateString(); nhdto.Machinhanh = machinhanh; nhaphangbus nhb = new nhaphangbus(); nhb.add(nhdto); madonnhap = nhdto.Manhaphang; madonnhaplbl.Text = madonnhap; nhapdon.Visible = false; nhapchitietdon.Visible = true; vatphambus vpbus = new vatphambus(); danhsachsanpham1dgv.DataSource = vpbus.listvatpham(); DataGridViewImageColumn ic = new DataGridViewImageColumn(); ic.HeaderText = "Hình ảnh"; ic.Image = null; ic.Name = "cImg"; ic.Width = 100; danhsachsanpham1dgv.Columns.Insert(0, ic); danhsachsanpham1dgv.Columns[2].Visible = false; foreach (DataGridViewRow row in danhsachsanpham1dgv.Rows) { DataGridViewImageCell cell = row.Cells[0] as DataGridViewImageCell; string path = row.Cells[2].Value.ToString(); path = appPath + path; Console.WriteLine(path); cell.Value = Bitmap.FromFile(path); row.Height = 100; } }