public static void chargerImage(etat e, FormControlePrintScreen form) { switch (e) { case etat.initial: form.Hide(); System.Threading.Thread.Sleep(250); FormWindowScreen formWS = new FormWindowScreen(); formWS.ShowDialog(); break; case etat.fonctionnement: using (MemoryStream s = new MemoryStream()) { try { //save graphic variable into memory FormControlePrintScreen.imprimeEcran.Save(s, ImageFormat.Bmp); form.pictureBoxMain.Size = new System.Drawing.Size(form.Width, form.Height); //set the picture box with temporary stream form.pictureBoxMain.Image = Image.FromStream(s); } catch (Exception ex) { MessageBox.Show(ex.GetType().ToString()); } finally { } } break; } }
private void buttonNew_Click(object sender, EventArgs e) { this.Hide(); System.Threading.Thread.Sleep(250); FormWindowScreen formWS = new FormWindowScreen(); formWS.ShowDialog(); }