public void Alert(string msg, Form_Alert.enumType type) { Form_Alert frm = new Form_Alert(); frm.showAlert(msg, type); }
public void showAlert(string msg, enumType type) { this.Opacity = 0.0; this.StartPosition = FormStartPosition.Manual; string fname; for (int i = 0; i < 10; i++) { fname = "alert" + i.ToString(); Form_Alert frm = (Form_Alert)Application.OpenForms[fname]; if (frm == null) { this.Name = fname; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width - 20; //this.y = Screen.PrimaryScreen.Bounds.Height - this.Height * i -5 * i; //if (fname == "alert0") //{ this.y = Screen.PrimaryScreen.Bounds.Top - this.Top * i + 53 * i; //} this.Location = new Point(this.x, this.y); break; } } this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; switch (type) { case enumType.Success: this.pictureBox1.Image = Resources.Success; this.BackColor = Color.SeaGreen; break; case enumType.Error: this.pictureBox1.Image = Resources.Error; this.BackColor = Color.DarkRed; break; case enumType.Info: this.pictureBox1.Image = Resources.Info; this.BackColor = Color.RoyalBlue; break; case enumType.Warning: this.pictureBox1.Image = Resources.Warning; this.BackColor = Color.DarkOrange; break; case enumType.Edit: this.pictureBox1.Image = Resources.Edit; this.BackColor = Color.Black; break; } this.lbl_Msg.Text = msg; // home.home2.addControlsTopanel2(this); // home.home2.panel5.Visible = true; // home.home2.Show(); this.Show(); //this.Focus(); this.action = enmAction.start; this.timer1.Interval = 1; timer1.Start(); }