// nouvelle instance de frm2 Form frm = new frm2(); // on inscrit la référence à frm1 (this) dans notre instance de frm2 frm2.Owner = this; // on cache la frm1 this.Hide();
// on réaffiche l'instance de frm1 (référencée dans Owner de frm2) this.Owner.Show(); // on kill la frm2 this.Close();
Form2 test = new Form2(this);
private Form1 f1; public Form2(Form1 f1) { InitializeComponent(); this.f1 = f1; } private void button1_Click(object sender, EventArgs e) { //ici code pour masquer/afficher le form1 //avec un test sur f1.Visibility if (f1.WindowState == FormWindowState.Normal) { f1.WindowState = FormWindowState.Minimized; } }
Form form2 = new Form2(); this.Hide(); form2.ShowModal(); this.Show();
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question