} /// <summary> /// 构造一个提示框 /// </summary> /// <param name="title">提示框标题</param> /// <param name="message">提示框文本</param> /// <param name="time">自动退出时间</param> public Tips(string title, string message, int time) : this() { Text = title; label1.Text = message; _ShowTime = time <= 0?3000: time; // 强制退出上一实例 if (_PrevInstance != null) { _PrevInstance.Close(); _PrevInstance = null; } // 注册当前为上一实例 _PrevInstance = this; Rectangle rt = Screen.PrimaryScreen.Bounds; _TaskHeight = rt.Height - Screen.PrimaryScreen.WorkingArea.Height; this.Location = new Point(rt.Right, rt.Bottom); _X = rt.Right - this.Width; _Y = rt.Bottom; // 上移开坮 _Up = true; _ExitTimer.Enabled = true; _MoveTimer.Enabled = true; _MoveTimer.Interval = 25; _MoveTimer.Tick += new EventHandler(MoveTimer_Tick); _MoveTimer.Start(); }
public void AnimatedExit() { // 注销上一实例 _PrevInstance = null; _ExitTimer.Stop(); _Up = false; _MoveTimer.Start(); }