Esempio n. 1
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (this.InfoState != InformStyle.Vanish) //如果窗体的状态不是隐藏
     {
         this.alerttimer.Stop();               //停止计时器
         this.InfoState = InformStyle.Vanish;  //设置窗体的操作状态为隐藏
         this.Hide();
         //base.Hide();//隐藏当前窗体
         // this.Close();
     }
 }
Esempio n. 2
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            Console.WriteLine("123");
            switch (this.InfoState)
            {
            case InformStyle.Display:                       //显示当前窗体
                this.timer1.Stop();                         //停止计时器
                this.timer1.Interval = 100;                 //设置时间间隔为100
                if (!(this.isMouseMove))                    //如果鼠标不在窗体中移动
                {
                    this.InfoState = InformStyle.Vanishing; //设置当前窗体的操作状态为隐藏中
                }
                this.timer1.Start();                        //启动计时器
                break;

            case InformStyle.Displaying:                                                 //当前窗体显示中
                if (this.Height <= this.Rect.Height - 12)                                //当窗体没有完全显示时
                {
                    this.SetBounds(Rect.X, this.Top - 12, Rect.Width, this.Height + 12); //使窗体不断上移
                }
                else
                {
                    this.timer1.Stop();                                      //停止计时器
                    this.SetBounds(Rect.X, Rect.Y, Rect.Width, Rect.Height); //设置当前窗体的边界
                    this.InfoState       = InformStyle.Display;              //设置当前窗体的操作状态为显示
                    this.timer1.Interval = 5000;                             //设置时间间隔为5000
                    this.timer1.Start();                                     //启动计时器
                }
                break;

            case InformStyle.Vanishing:                      //隐藏当前窗体
                if (this.isMouseMove)                        //如果鼠标在窗体中移动
                {
                    this.InfoState = InformStyle.Displaying; //设置窗体的操作状态为显示
                }
                else
                {
                    if (this.Top <= this.Rect.Bottom - 12)                                   //如果窗体没有完全隐藏
                    {
                        this.SetBounds(Rect.X, this.Top + 12, Rect.Width, this.Height - 12); //使窗体不断下移
                    }
                    else
                    {
                        timer1.Stop();
                        this.Hide();                         //隐藏当前窗体
                        this.InfoState = InformStyle.Vanish; //设置窗体的操作状态为隐藏
                    }
                }
                break;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 显示窗体
        /// </summary>
        public void Show()
        {
            switch (this.InfoState)
            {
            case InformStyle.Vanish:                                         //窗体隐藏
                this.InfoState = InformStyle.Displaying;                     //设置窗体的操作状态为显示中
                this.SetBounds(Rect.X, Rect.Y + Rect.Height, Rect.Width, 0); //显示Popup窗体,并放置到屏幕的底部
                ShowWindow(this.Handle, 4);                                  //显示窗体
                this.timer1.Interval = 100;                                  //设置时间间隔为100
                this.timer1.Start();                                         //启动计时器
                break;

            case InformStyle.Display:        //窗体显示
                this.timer1.Stop();          //停止计时器
                this.timer1.Interval = 5000; //设置时间间隔为5000
                this.timer1.Start();         //启动记时器
                break;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 显示窗体
 /// </summary>
 public void Show()
 {
     switch (this.InfoState)
     {
         case InformStyle.Vanish://窗体隐藏
             this.InfoState = InformStyle.Displaying;//设置窗体的操作状态为显示中
             this.SetBounds(Rect.X, Rect.Y + Rect.Height, Rect.Width, 0);//显示Popup窗体,并放置到屏幕的底部
             ShowWindow(this.Handle, 4);//显示窗体
             this.timer1.Interval = 100;//设置时间间隔为100
             this.timer1.Start();//启动计时器
             break;
         case InformStyle.Display://窗体显示
             this.timer1.Stop();//停止计时器
             this.timer1.Interval = 5000;//设置时间间隔为5000
             this.timer1.Start();//启动记时器
             break;
     }
 }
Esempio n. 5
0
 private void timer1_Tick(object sender, System.EventArgs e)
 {
     Console.WriteLine("123");
     switch (this.InfoState)
     {
         case InformStyle.Display://显示当前窗体
             this.timer1.Stop();//停止计时器
             this.timer1.Interval = 100;//设置时间间隔为100
             if (!(this.isMouseMove))//如果鼠标不在窗体中移动
                 this.InfoState = InformStyle.Vanishing;//设置当前窗体的操作状态为隐藏中
             this.timer1.Start();//启动计时器
             break;
         case InformStyle.Displaying://当前窗体显示中
             if (this.Height <= this.Rect.Height - 12)//当窗体没有完全显示时
                 this.SetBounds(Rect.X, this.Top - 12, Rect.Width, this.Height + 12);//使窗体不断上移
             else
             {
                 this.timer1.Stop();//停止计时器
                 this.SetBounds(Rect.X, Rect.Y, Rect.Width, Rect.Height);//设置当前窗体的边界
                 this.InfoState = InformStyle.Display;//设置当前窗体的操作状态为显示
                 this.timer1.Interval = 5000;//设置时间间隔为5000
                 this.timer1.Start();//启动计时器
             }
             break;
         case InformStyle.Vanishing://隐藏当前窗体
             if (this.isMouseMove)//如果鼠标在窗体中移动
                 this.InfoState = InformStyle.Displaying;//设置窗体的操作状态为显示
             else
             {
                 if (this.Top <= this.Rect.Bottom - 12)//如果窗体没有完全隐藏
                     this.SetBounds(Rect.X, this.Top + 12, Rect.Width, this.Height - 12);//使窗体不断下移
                 else
                 {
                     timer1.Stop();
                     this.Hide();//隐藏当前窗体
                     this.InfoState = InformStyle.Vanish;//设置窗体的操作状态为隐藏
                 }
             }
             break;
     }
 }