Home
Manage Your Code
Snippet: Make your task Bar Blink UI-tools Part 2 (C#)
Title: Make your task Bar Blink UI-tools Part 2 Language: C#
Description: Part 2 0f 2 to make the Task bar blink in a separate class file. Written by Hawkstalon Views: 244
Author: Wayne Burgess Date Added: 8/6/2008
Copy Code  
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8using UI.Tools;
9 
10namespace WindowsFormsApplication3
11{
12    public partial class Form1 : Form
13    {
14 
15        private bool alertRaised = false;
16        private bool _blink = false;
17 
18        public Form1()
19        {
20            InitializeComponent();
21        }
22 
23        private void Form1_Load(object sender, EventArgs e)
24        {
25 
26 
27        }
28 
29        private void alert_Tick(object sender, EventArgs e)
30        {
31            if (!alertRaised)
32            {
33                //blink.Interval = 500;

34                //blink.Enabled = true;

35                //blink.Start();

36                UI.Tools.Forms.FlashWindowEx(this.Handle, Forms.dwFlags.FLASHW_ALL, 20, 0);
37                alertRaised = true;
38 
39            }
40        }
41 
42        private void blink_Tick(object sender, EventArgs e)
43        {
44            if (!_blink)
45            {
46                //FlashWindow(this.Handle, true);

47                //FlashWindowEx(this.Handle);

48                _blink = true;
49            }
50            else
51            {
52                //FlashWindow(this.Handle, false);

53 
54                _blink = false;
55            }
56        }
57 
58        private void Form1_Activated(object sender, EventArgs e)
59        {
60            alertRaised = false;
61            alert.Interval = 10000;
62            alert.Stop();
63            alert.Enabled = false;
64            UI.Tools.Forms.FlashWindowEx(this.Handle, Forms.dwFlags.FLASHW_STOP, 0, 0);
65            //blink.Stop();

66            //blink.Enabled = false;

67        }
68 
69        private void Form1_Deactivate(object sender, EventArgs e)
70        {
71            alert.Interval = 10000;
72            alert.Enabled = true;
73            alert.Start();
74        }
75    }
76}
Notes
C# 2.0 .net 2.0