public void showAlert(string msg) { this.StartPosition = FormStartPosition.Manual; string fname; for (int i = 1; i < 10; i++) { fname = "Alert" + i.ToString(); Notifi frm = (Notifi)Application.OpenForms[fname]; if (frm == null) { this.Name = fname; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height * i; this.Location = new Point(x, y); break; } } this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; this.labelText.Text = msg; this.BringToFront(); this.Show(); this.action = enumAction.start; timer1.Interval = 1; timer1.Start(); }
private void timer1_Tick(object sender, EventArgs e) { switch (this.action) { case enumAction.wait: timer1.Interval = 10000; action = enumAction.close; break; case Notifi.enumAction.start: this.timer1.Interval = 1; this.Opacity += 0.1; if (this.x < this.Location.X) { this.Left--; } else { if (this.Opacity == 1.0) { action = Notifi.enumAction.wait; } } break; case enumAction.close: timer1.Interval = 1; this.Opacity -= 0.1; this.Left -= 3; if (base.Opacity == 0.0) { base.Close(); } break; } }
private void btnClose_Click(object sender, EventArgs e) { timer1.Interval = 1; action = enumAction.close; }
private void bunifuImageButton1_Click(object sender, EventArgs e) { timer1.Interval = 1; action = enumAction.close; }