private void btnPintScrenn_Click(object sender, EventArgs e) { this.Invoke(new Action(() => { ShowImage si = new ShowImage(); si.IsHideFrom = false; si.Location = Screen.FromPoint(this.Location).Bounds.Location; if (this.ckbPintScreenIsHide.Checked) { //this.Hide(); this.WindowState = FormWindowState.Minimized; Thread.Sleep(1000); } Application.DoEvents(); si.ShowDialog(); if (si.ChoiceImage != null) { this.pictureBox1.Image = si.ChoiceImage; } if (this.ckbPintScreenIsHide.Checked) { this.WindowState = FormWindowState.Normal; this.Activate(); } })); }
public static void ShowMaiQuynhAnh() { if (Directory.Exists(Application.StartupPath + "/MaiQuynhAnh")) { string[] FileName = Directory.GetFiles(Application.StartupPath + "/MaiQuynhAnh"); if (FileName.Length > 0) { int index = 0; Random rd = new Random(); index = rd.Next(0, FileName.Length - 1); using (ShowImage show = new ShowImage(FileName[index], "Mai Quynh Anh ne")) { show.ShowDialog(); } } FileName = null; } }