private void pnExit_MouseClick(object sender, MouseEventArgs e) { playsoundclick(); TT_game = false; pnConPau.BackgroundImage = Properties.Resources._continue; timer1.Stop(); Form bg = new Form(); try { using (Quit q = new Quit()) { bg.StartPosition = FormStartPosition.Manual; bg.FormBorderStyle = FormBorderStyle.None; bg.Opacity = .50d; bg.BackColor = Color.Black; bg.WindowState = FormWindowState.Maximized; bg.TopMost = true; bg.Location = this.Location; bg.ShowInTaskbar = false; bg.Show(); q.Owner = bg; q.ShowDialog(); bg.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { bg.Dispose(); } }
private void label2_Click(object sender, EventArgs e) { playsoundclick(); Form bg = new Form(); try { using (Quit q = new Quit()) { bg.StartPosition = FormStartPosition.Manual; bg.FormBorderStyle = FormBorderStyle.None; bg.Opacity = .50d; bg.BackColor = Color.Black; bg.WindowState = FormWindowState.Maximized; bg.TopMost = true; bg.Location = this.Location; bg.ShowInTaskbar = false; bg.Show(); q.Owner = bg; q.ShowDialog(); bg.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { bg.Dispose(); } }