| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- namespace UAS_XmlAnalysor
- {
- public partial class Tip : Form
- {
- int state;
- private DoWorkEventArgs e;
- public Tip()
- {
- InitializeComponent();
- }
- private void Form2_Load(object sender, EventArgs e)
- {
- this.ShowInTaskbar = false;
- this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
- this.Top = this.Height;
- state = 0;
- label1.Text = DateTime.Now.ToString();
- }
- public void startthread(string filename)
- {
- label1.Text = filename+"解析完成";
- //thread.Start();
- using (BackgroundWorker bw = new BackgroundWorker())
- {
- bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
- bw.DoWork += new DoWorkEventHandler(bw_DoWork);
- bw.RunWorkerAsync("Tank");
- }
- }
- private void bw_DoWork(object sender, DoWorkEventArgs e)
- {
- }
- private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- aa();
- Thread.Sleep(500);
- bb();
- }
- public void aa()
- {
- if (state == 0)
- {
- state = 1;
- int t = this.Left;
- for (int i = t; i >= Screen.PrimaryScreen.WorkingArea.Width - this.Width; i--)
- {
- this.Left = i;
- Application.DoEvents();
- }
- state = 0;
- }
- }
- public void bb()
- {
- if (this.Left <= Screen.PrimaryScreen.WorkingArea.Width - 10 && state == 0)
- {
- state = 1;
- int t = this.Left;
- for (int i = t; i < Screen.PrimaryScreen.WorkingArea.Width - 10; i++)
- {
- this.Left = i;
- Application.DoEvents();
- }
- state = 0;
- }
- }
- private void Form2_MouseEnter(object sender, EventArgs e)
- {
- if (state == 0)
- {
- state = 1;
- int t = this.Left;
- for (int i = t; i >= Screen.PrimaryScreen.WorkingArea.Width - this.Width; i=i-2)
- {
- this.Left = i;
- Application.DoEvents();
- }
- state = 0;
- }
- }
- private void Form2_MouseLeave(object sender, EventArgs e)
- {
- if (this.Left <= Screen.PrimaryScreen.WorkingArea.Width - 10 && state == 0)
- {
- state = 1;
- int t = this.Left;
- for (int i = t; i < Screen.PrimaryScreen.WorkingArea.Width - 10; i=i+2)
- {
- this.Left = i;
- Application.DoEvents();
- }
- state = 0;
- }
- }
- }
- }
|