Frm_main.cs
View code
1 Using System;
2 Using System. Collections. Generic;
3 Using System. componentmodel;
4 Using System. Data;
5 Using System. drawing;
6 Using System. text;
7 Using System. Windows. forms;
8 Using System. runtime. interopservices;
9
10 Namespace Flashwindowbar
11 {
12 Public Partial Class Frm_main: Form
13 {
14 Public Frm_main ()
15 {
16 Initializecomponent ();
17 }
18
19 // Rewrite the API function to flash the Form title bar.
20 [System. runtime. interopservices. dllimportattribute ( " User32.dll " )]
21 Public Static Extern Bool Flashwindow (intptr handle, Bool Binvert );
22
23 Private Void Timereffectick (Object Sender, eventargs E)
24 {
25 Flashwindow ( This . Handle, True ); // Enable the form blinking Function
26 }
27
28 Private Void Button#click (Object Sender, eventargs E)
29 {
30 Timer1.enabled = True ; // Start Timer
31 }
32
33 Private Void Button2_click ( Object Sender, eventargs E)
34 {
35 Timer1.enabled = False ; // Disable Timer
36 }
37 }
38 }
Frm_main.designer.cs
View code
1 Namespace Flashwindowbar
2 {
3 Partial Class Frm_main
4 {
5 /// <Summary>
6 /// Required designer variables.
7 /// </Summary>
8 Private System. componentmodel. icontainer components = Null ;
9
10 /// <Summary>
11 /// Clear all resources in use.
12 /// </Summary>
13 /// <Param name = "disposing"> If the managed resources should be released, the value is true; otherwise, the value is false. </Param>
14 Protected Override Void Dispose ( Bool Disposing)
15 {
16 If (Disposing & (components! = Null ))
17 {
18 Components. Dispose ();
19 }
20 Base . Dispose (disposing );
21 }
22
23 # Region The Code
24
25 /// <Summary>
26 /// Required methods supported by the designer-do not
27 /// Use the code editor to modify the content of this method.
28 /// </Summary>
29 Private Void Initializecomponent ()
30 {
31 This . Components = New System. componentmodel. Container ();
32 This . Picturebox1 = New System. Windows. Forms. picturebox ();
33 This . Button1 = New System. Windows. Forms. Button ();
34 This . Button2 = New System. Windows. Forms. Button ();
35 This . Timer1 = New System. Windows. Forms. Timer ( This . Components );
36 (System. componentmodel. isupportinitialize )( This . Picturebox1). begininit ();
37 This . Suspendlayout ();
38 //
39 // Picturebox1
40 //
41 This . Picturebox1.dock = system. Windows. Forms. dockstyle. Fill;
42 This . Picturebox1.location = New System. Drawing. Point (0 , 0 );
43 This . Picturebox1.name = " Picturebox1 " ;
44 This . Picturebox1.size = New System. Drawing. Size ( 325 , 127 );
45 This . Picturebox1.tabindex = 0 ;
46 This . Picturebox1.tabstop = False ;
47 //
48 // Button1
49 //
50 This . Button1.location = New System. Drawing. Point ( 55 , 50 );
51 This . Button1.name = " Button1 " ;
52 This . Button1.size = New System. Drawing. Size ( 75 ,23 );
53 This . Button1.tabindex = 1 ;
54 This . Button1.text = " Start flashing " ;
55 This . Button1.usevisualstylebackcolor = True ;
56 This . Button1.click + = New System. eventhandler ( This . Button#click );
57 //
58 // Button2
59 //
60 This . Button2.location = New System. Drawing. Point ( 196 , 50 );
61 This . Button2.name = " Button2 " ;
62 This . Button2.size = New System. Drawing. Size ( 75 , 23 );
63 This . Button2.tabindex = 2 ;
64 This . Button2.text = " Stop flashing " ;
65 This . Button2.usevisualstylebackcolor = True ;
66 This . Button2.click + = New System. eventhandler (This . Button2_click );
67 //
68 // Timer1
69 //
70 This . Timer1.tick + = New System. eventhandler ( This . Timereffectick );
71 //
72 // Frm_main
73 //
74 This . Autoscaledimensions = New System. Drawing. sizef (6f, 12f );
75 This . Autoscalemode = system. Windows. Forms. autoscalemode. Font;
76 This . Clientsize = New System. Drawing. Size ( 325 , 127 );
77 This . Controls. Add ( This . Button2 );
78 This . Controls. Add ( This . Button1 );
79 This . Controls. Add ( This . Picturebox1 );
80 This . Name = " Frm_main " ;
81 This . Startposition = system. Windows. Forms. formstartposition. centerscreen;
82 This . Text = " Set flashing title bars " ;
83 (System. componentmodel. isupportinitialize )( This . Picturebox1). endinit ();
84 This . Resumelayout ( False );
85
86 }
87
88 # Endregion
89
90 Private System. Windows. Forms. picturebox picturebox1;
91 Private System. Windows. Forms. Button button1;
92 Private System. Windows. Forms. Button button2;
93 Private System. Windows. Forms. Timer timer1;
94 }
95 }