#windows桌面计时器软件
##主要功能
支持3-1000分钟的计时
计时完成可以弹窗提醒,可以软件全屏提醒
小巧方便
可以后台运行,定时时间到后会全屏出来提醒你
主要用于刷网课到时间蹦出来提醒你下一节,打包好的软件在我的资源里面有,积分下载
制作方法,winform制作
代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 桌面计时器
{
public partial class Form1 : Form
{
int zongshjian = 0;
int nowshijian = 0;
bool flagjishi = false;
bool flagtanchuang = false;
public Form1()
{
InitializeComponent();
nowshijian = 0;
zongshjian = (int)numericUpDown1.Value*60;
label1.Text = nowshijian.ToString() + “/” + zongshjian.ToString();
this.BackColor = Color.LightGray;
}
private void button2_Click(object sender, EventArgs e)
{
if (flagjishi) //当前正在计时
{
flagjishi = false;
nowshijian = 0;
button2.Text = "开始计时";
this.BackColor = Color.LightGray;
}
else
{
button2.Text = "停止计时";
this.BackColor = Color.White;
nowshijian = 0;
zongshjian = (int)numericUpDown1.Value*60;
flagjishi = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (flagjishi)
{
nowshijian++;
if (nowshijian >= zongshjian)
{
nowshijian = 0;
flagjishi = false;
button2.Text = "开始计时";
this.BackColor = Color.LightGreen;
if(flagtanchuang)
MessageBox.Show("计时完成");
this.WindowState = FormWindowState.Maximized;
}
}
label1.Text = nowshijian.ToString() + "/" + zongshjian.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.TopMost = checkBox1.Checked;
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
flagtanchuang = checkBox2.Checked;
}
}
}