This repository was archived by the owner on Sep 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFrmShowNotification.cs
More file actions
80 lines (71 loc) · 2 KB
/
FrmShowNotification.cs
File metadata and controls
80 lines (71 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace ChDCToolsNotice
{
public partial class FrmNotification : Form
{
public FrmNotification(Image icon, string title, string msg)
{
InitializeComponent();
picIcon.Image = icon;
lblTitle.Text = this.Text = title;
lblMsg.Text = msg;
this.Left = Screen.PrimaryScreen.Bounds.Right - this.Width - 10;
this.Top = Screen.PrimaryScreen.Bounds.Height / 10;
// this.ClientSize = new Size(labMsg.Width + 16, labMsg.Height + 16);
}
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x00000080; // WS_EX_TOOLWINDOW
return cp;
}
}
private void FrmNotification_Load(object sender, EventArgs e)
{
timerShow.Start();
}
private void timerShow_Tick(object sender, EventArgs e)
{
Opacity += .1;
if (Opacity == 1)
{
timerShow.Stop();
timerHode.Start();
}
}
int hode = 0;
Boolean focusOn = false;
private void timerHode_Tick(object sender, EventArgs e)
{
if(!focusOn)
hode++;
if (hode >= 30)
{
timerHode.Stop();
timerHide.Start();
}
}
private void timerHide_Tick(object sender, EventArgs e)
{
this.Opacity -= 0.1;
if (Opacity == 0)
{
timerHide.Stop();
this.Close();
}
}
private void FrmNotification_MouseEnter(object sender, EventArgs e)
{
focusOn = true;
}
private void FrmNotification_MouseLeave(object sender, EventArgs e)
{
focusOn = false;
}
}
}