private void ButtonTang_Click(object sender, EventArgs e) { ThietbiUC dynamicButton = (sender as ThietbiUC); cls_Main._Luachon = (Convert.ToInt32(dynamicButton.Name)); Details(); }
public void ThietBiL(string NameOfButt, int left, int top, Panel contain, int count, string mt, string tt, int st, int rent, int fix, int _lblid, int maloaitb) { ThietbiUC newButt = new ThietbiUC(); var _with1 = newButt; _with1.Name = _lblid.ToString(); if (_with1.Name == "cmd1" + _lblid) { _with1.ForeColor = Color.White; } _with1.lblten.Text = NameOfButt; if (st == 1) { _with1.lblsudung.Text = tt; _with1.lblmieuta.Text = mt; _with1.lblsudung.ForeColor = Color.Gray; _with1.lblMuonFix.Visible = false; _with1.lblmuontitle.Visible = false; if (rent == 3) { _with1.lblMuonFix.Visible = true; _with1.lblmuontitle.Visible = true; _with1.lblMuonFix.Text = "Đang mượn"; _with1.lblMuonFix.ForeColor = Color.Teal; } ; } else { _with1.lblsudung.Text = tt; _with1.lblmieuta.Text = mt; _with1.lblsudung.ForeColor = Color.PaleVioletRed; _with1.lblmuontitle.Visible = false; if (fix == 4) { _with1.lblMuonFix.Visible = true; _with1.lblMuonFix.Text = "Đang sửa"; _with1.lblMuonFix.ForeColor = Color.SpringGreen; } } if (maloaitb == 2) { _with1.picht.Image = null; _with1.picht.SizeMode = PictureBoxSizeMode.StretchImage; _with1.picht.Image = Properties.Resources._64_64_7a4c085c58d540d7bd9527af2e4964dd__1_; } else { _with1.picht.Image = null; _with1.picht.SizeMode = PictureBoxSizeMode.StretchImage; _with1.picht.Image = Properties.Resources._1448269194_SDKs_copy_Android; } _with1.lbl_id.Text = _lblid.ToString(); _with1.Location = new Point(left, top); contain.Controls.Add(newButt); newButt.Click += new EventHandler(this.ButtonTang_Click); }