示例#1
0
 /// <summary>
 /// 将以动画的形式显示,默认存在时间为 5 秒
 /// </summary>
 /// <param name="caption">窗口标题</param>
 /// <param name="text">窗口内容</param>
 public static void AnimalShow(string caption, string text)
 {
     try
     {
         if (NotifyForm.Notify == null)
         {
             NotifyForm.Notify = new NotifyForm();
         }
         if (NotifyForm.Timer == null)
         {
             NotifyForm.Timer = new Timer();
         }
         if (!string.IsNullOrEmpty(caption))
         {
             NotifyForm.Notify.Text = caption;
         }
         if (!string.IsNullOrEmpty(text))
         {
             NotifyForm.Notify.NotifyText = text;
         }
         NotifyForm.Timer.Interval = 100;
         NotifyForm.Timer.Tick    += new EventHandler(Timer_Tick);
         NotifyForm.Timer.Enabled  = true;
         NotifyForm.Notify.Show();
     }
     catch (Exception ex)
     {
         Debug.WriteLine("NotifyForm.AnimalShow() :: " + ex.Message);
         throw ex;
     }
 }
示例#2
0
 /// <summary>
 /// 执行窗口动画操作
 /// </summary>
 protected static void Timer_Tick(object sender, EventArgs e)
 {
     try
     {
         if (NotifyForm.Notify != null)
         {
             // 动态改变窗口位置
             int pos = NotifyForm.Notify.Height / 100;
             int top = Screen.PrimaryScreen.WorkingArea.Height - NotifyForm.Notify.Height;
             if (NotifyForm.Notify.Top > top + pos * 10)
             {
                 for (int i = 0; i < 35; i++)
                 {
                     NotifyForm.Notify.Top -= pos;
                 }
             }
             else
             {
                 NotifyForm.Notify.Top = top;
                 if (NotifyForm.ShowInterval > NotifyForm.Interval)
                 {
                     NotifyForm.Timer.Interval = 1000;
                     NotifyForm.Interval++;
                 }
                 else
                 {
                     NotifyForm.Timer.Interval = 100;
                     if (NotifyForm.Notify != null)
                     {
                         if (NotifyForm.Notify.Opacity > 0)  // 动画降低窗口透明度
                         {
                             NotifyForm.Notify.Opacity -= 0.1;
                         }
                         else                                // 释放窗口资源
                         {
                             NotifyForm.Interval      = 0;
                             NotifyForm.Timer.Enabled = false;
                             NotifyForm.Timer.Dispose();
                             NotifyForm.Timer = null;
                             NotifyForm.Notify.Dispose();
                             NotifyForm.Notify = null;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("NotifyForm.Timer_Tick(object, EventArgs) :: " + ex.Message);
         throw ex;
     }
 }
示例#3
0
 /// <summary>
 /// 将以动画的形式显示,默认存在时间为 5 秒
 /// </summary>
 /// <param name="caption">窗口标题</param>
 /// <param name="text">窗口内容</param>
 /// <param name="interval">窗口存在的时间h</param>
 public static void AnimalShow(string caption, string text, int interval)
 {
     NotifyForm.ShowInterval = interval;
     NotifyForm.AnimalShow(caption, text);
 }
示例#4
0
 /// <summary>
 /// 将以动画的形式显示,默认存在时间为 5 秒
 /// </summary>
 /// <param name="caption">窗口标题</param>
 public static void AnimalShow(string caption)
 {
     NotifyForm.AnimalShow(caption, null);
 }
示例#5
0
 /// <summary>
 /// 将以动画的形式显示窗口,默认存在时间为 5 秒
 /// </summary>
 public static void AnimalShow()
 {
     NotifyForm.AnimalShow(null, null);
 }