首页 > 代码库 > 正在进行中效果

正在进行中效果

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Windows.Forms;
 9 
10 namespace TestApplication1
11 {
12     public partial class ProgressPic : UserControl
13     {
14         Timer ti;
15         byte buffer = 0;
16 
17         public ProgressPic()
18         {
19             InitializeComponent();
20             ti = new Timer();
21             ti.Interval = 1000;
22             ti.Tick += new EventHandler(ti_Tick);
23             ti.Start();
24         }
25 
26         void ti_Tick(object sender, EventArgs e)
27         {
28             label1.Refresh();
29             label2.Refresh();
30             label3.Refresh();
31             label4.Refresh();
32             label5.Refresh();
33             buffer++;
34             if (buffer > 4)
35                 buffer = 0;
36             SolidBrush b = new SolidBrush(Color.Violet);
37             Rectangle rc = new Rectangle(0, 0, label1.Width, label1.Height);
38             switch (buffer)
39             {
40                 case 0:
41                     {
42                         Graphics g = label5.CreateGraphics();
43                         g.FillRectangle(b, rc);
44                         g.Dispose();
45                     }
46                     break;
47                 case 1:
48                     {
49                         Graphics g = label1.CreateGraphics();
50                         g.FillRectangle(b, rc);
51                         g.Dispose();
52                     }
53                     break;
54                 case 2:
55                     {
56                         Graphics g = label2.CreateGraphics();
57                         g.FillRectangle(b, rc);
58                         g.Dispose();
59                     }
60                     break;
61                 case 3:
62                     {
63                         Graphics g = label3.CreateGraphics();
64                         g.FillRectangle(b, rc);
65                         g.Dispose();
66                     }
67                     break;
68                 case 4:
69                     {
70                         Graphics g = label4.CreateGraphics();
71                         g.FillRectangle(b, rc);
72                         g.Dispose();
73                     }
74                     break;
75             }
76             b.Dispose();
77         }
78     }
79 }