自己修改的一个窗口特效类
1 using System;
2 using System.Drawing;
3 using System.Drawing.Imaging;
4 using System.Runtime.InteropServices;
5 namespace myForm
6 {
7 /// <summary>
8 /// Show 的摘要说明。
9 /// </summary>
10 public class Show
11 {
12 System.Windows.Forms.Form this_form=null;
13 public Show(System.Windows.Forms.Form form)
14 {
15 //
16 // TODO: 在此处添加构造函数逻辑
17 //
18 this_form=form;
19
20 }
21 [ DllImport("user32") ]
22 public static extern System.IntPtr GetDC(System.IntPtr dc);
23 System.Drawing.Graphics g; //画图板
24
25 Pen p=new Pen(Color.Blue,1); //画笔
26
27 int startx,starty,wx,wy,step; //startx,starty,wx,wy确定一个矩形
28
29 int cx,cy; //cx,cy为form的client的width 和height
30
31 public void DoShow()
32 {
33 this_form.Visible=false;
34
35 step=1;
36
37 g=Graphics.FromHdc(GetDC(System.IntPtr.Zero));
38
39 cx=this_form.ClientSize.Width;
40
41 cy=this_form.ClientSize.Height;
42
43 this_form.Visible=false;
44
45 step=1;
46
47 while(step<=cx/2)
48
49 {
50 startx=cx/2-step;
51
52 starty=cy*startx/cx;
53
54 wx=2*step;
55
56 wy=wx*cy/cx;
57
58 startx+=this_form.Left;
59
60 starty+=this_form.Top+this_form.Height-this_form.ClientSize.Height;
61 g.DrawRectangle(p,startx,starty,wx,wy);
62
63 System.Threading.Thread.Sleep(100);
64
65 step+=10;
66 }
67
68 this_form.Visible=true;
69 }
70 }
71 }
72
2 using System.Drawing;
3 using System.Drawing.Imaging;
4 using System.Runtime.InteropServices;
5 namespace myForm
6 {
7 /// <summary>
8 /// Show 的摘要说明。
9 /// </summary>
10 public class Show
11 {
12 System.Windows.Forms.Form this_form=null;
13 public Show(System.Windows.Forms.Form form)
14 {
15 //
16 // TODO: 在此处添加构造函数逻辑
17 //
18 this_form=form;
19
20 }
21 [ DllImport("user32") ]
22 public static extern System.IntPtr GetDC(System.IntPtr dc);
23 System.Drawing.Graphics g; //画图板
24
25 Pen p=new Pen(Color.Blue,1); //画笔
26
27 int startx,starty,wx,wy,step; //startx,starty,wx,wy确定一个矩形
28
29 int cx,cy; //cx,cy为form的client的width 和height
30
31 public void DoShow()
32 {
33 this_form.Visible=false;
34
35 step=1;
36
37 g=Graphics.FromHdc(GetDC(System.IntPtr.Zero));
38
39 cx=this_form.ClientSize.Width;
40
41 cy=this_form.ClientSize.Height;
42
43 this_form.Visible=false;
44
45 step=1;
46
47 while(step<=cx/2)
48
49 {
50 startx=cx/2-step;
51
52 starty=cy*startx/cx;
53
54 wx=2*step;
55
56 wy=wx*cy/cx;
57
58 startx+=this_form.Left;
59
60 starty+=this_form.Top+this_form.Height-this_form.ClientSize.Height;
61 g.DrawRectangle(p,startx,starty,wx,wy);
62
63 System.Threading.Thread.Sleep(100);
64
65 step+=10;
66 }
67
68 this_form.Visible=true;
69 }
70 }
71 }
72