Exemplo n.º 1
0
        private void ToastForm_Load(object sender, EventArgs e)
        {
            this.Height = linkLabel.Bottom + (this.Bounds.Height - this.ClientRectangle.Height) + 8;

            // Display the form just above the system tray.
            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width - 5,
                                      Screen.PrimaryScreen.WorkingArea.Height - this.Height - 5);

            if (openForms.Count >= maxNumConcurrentOpenForms)
            {
                for (int i = openForms.Count - maxNumConcurrentOpenForms; i >= 0; --i)
                {
                    ToastForm formToClose = openForms[i];
                    CloseViaAnimator(formToClose);
                }
            }

            // Move each open form upwards to make room for this one.
            foreach (ToastForm openForm in ToastForm.openForms)
            {
                openForm.Top -= this.Height + 5;
            }

            // Add this form from the open form list.
            ToastForm.openForms.Add(this);
        }
Exemplo n.º 2
0
 private void CloseViaAnimator(ToastForm form)
 {
     form.animator.Duration = form.animator.Duration / 3;
     form.Close();
 }