定时提醒的小工具
1
using System;
2
using System.Drawing;
3
using System.Collections;
4
using System.ComponentModel;
5
using System.Windows.Forms;
6
using System.Data;
7![]()
8
namespace NoticePad
9
{
10
/// <summary>
11
/// 定时提醒的小工具。
12
/// </summary>
13
public class Form1 : System.Windows.Forms.Form
14
{
15
private System.Windows.Forms.Label label1;
16
private System.Windows.Forms.Label label2;
17
private System.Windows.Forms.TextBox textBox1;
18
private System.Windows.Forms.Timer timer1;
19
private System.Windows.Forms.NumericUpDown ndHour;
20
private System.Windows.Forms.NumericUpDown ndMinute;
21
private System.Windows.Forms.Button btn_OK;
22
private System.ComponentModel.IContainer components;
23![]()
24
public Form1()
25
{
26
//
27
// Windows 窗体设计器支持所必需的
28
//
29
InitializeComponent();
30![]()
31
//
32
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
33
//
34
}
35![]()
36
/// <summary>
37
/// 清理所有正在使用的资源。
38
/// </summary>
39
protected override void Dispose( bool disposing )
40
{
41
if( disposing )
42
{
43
if (components != null)
44
{
45
components.Dispose();
46
}
47
}
48
base.Dispose( disposing );
49
}
50![]()
51
Windows Form Designer generated code
159![]()
160
/// <summary>
161
/// 应用程序的主入口点。
162
/// </summary>
163
[STAThread]
164
static void Main()
165
{
166
Application.Run(new Form1());
167
}
168![]()
169
private System.DateTime dtDes;
170
// 定时周期的检查是否到了提醒的时间了。
171
private void timer1_Tick(object sender, System.EventArgs e)
172
{
173
if (DateTime.Now > dtDes)
174
{
175
timer1.Enabled = false;
176
this.Show();
177
this.Activate();
178
}
179
}
180![]()
181
// 确定提醒的时间,然后隐藏该工具。
182
private void btn_OK_Click(object sender, System.EventArgs e)
183
{
184
dtDes = new DateTime(
185
DateTime.Today.Year,
186
DateTime.Today.Month,
187
DateTime.Today.Day,
188
(int)ndHour.Value,
189
(int)ndMinute.Value,
190
0,0);
191
timer1.Enabled = true;
192
this.Hide();
193
}
194
}
195
}
196![]()
using System;2
using System.Drawing;3
using System.Collections;4
using System.ComponentModel;5
using System.Windows.Forms;6
using System.Data;7

8
namespace NoticePad9
{10
/// <summary>11
/// 定时提醒的小工具。12
/// </summary>13
public class Form1 : System.Windows.Forms.Form14
{15
private System.Windows.Forms.Label label1;16
private System.Windows.Forms.Label label2;17
private System.Windows.Forms.TextBox textBox1;18
private System.Windows.Forms.Timer timer1;19
private System.Windows.Forms.NumericUpDown ndHour;20
private System.Windows.Forms.NumericUpDown ndMinute;21
private System.Windows.Forms.Button btn_OK;22
private System.ComponentModel.IContainer components;23

24
public Form1()25
{26
//27
// Windows 窗体设计器支持所必需的28
//29
InitializeComponent();30

31
//32
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码33
//34
}35

36
/// <summary>37
/// 清理所有正在使用的资源。38
/// </summary>39
protected override void Dispose( bool disposing )40
{41
if( disposing )42
{43
if (components != null) 44
{45
components.Dispose();46
}47
}48
base.Dispose( disposing );49
}50

51
Windows Form Designer generated code159

160
/// <summary>161
/// 应用程序的主入口点。162
/// </summary>163
[STAThread]164
static void Main() 165
{166
Application.Run(new Form1());167
}168

169
private System.DateTime dtDes;170
// 定时周期的检查是否到了提醒的时间了。171
private void timer1_Tick(object sender, System.EventArgs e)172
{173
if (DateTime.Now > dtDes)174
{175
timer1.Enabled = false;176
this.Show();177
this.Activate();178
}179
}180

181
// 确定提醒的时间,然后隐藏该工具。182
private void btn_OK_Click(object sender, System.EventArgs e)183
{184
dtDes = new DateTime(185
DateTime.Today.Year,186
DateTime.Today.Month,187
DateTime.Today.Day,188
(int)ndHour.Value,189
(int)ndMinute.Value,190
0,0);191
timer1.Enabled = true;192
this.Hide();193
}194
}195
}196



浙公网安备 33010602011771号