private void Drug_Form_Load(object sender, EventArgs e) { lbl.Add(((Label)label1)); lbl[0].Image = Image.FromFile(Application.StartupPath + "\\imag\\" + lbl[0].Tag); groupBox2.Controls.Clear(); Drug_insert_UI insert = new Drug_insert_UI(); insert.TopLevel = false; groupBox2.Controls.Add(insert); insert.Show(); }
private void label1_Click(object sender, EventArgs e) { groupBox2.Controls.Clear(); Drug_insert_UI insert = new Drug_insert_UI(); insert.TopLevel = false; groupBox2.Controls.Add(insert); insert.Show(); if (lbl.Count != 0) { string str = (lbl[0].Tag + "").Replace('-', ' '); lbl[0].Image = Image.FromFile(Application.StartupPath + "\\imag\\" + str); lbl.Clear(); } lbl.Add(((Label)sender)); ((Label)sender).Image = Image.FromFile(Application.StartupPath + "\\imag\\" + ((Label)sender).Tag); }