简易计时窗口程序
来源:互联网 发布:南山软件测试培训 编辑:程序博客网 时间:2024/06/07 03:54
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;
using System.Media;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int m, s;
string tm, ts;
private void timer1_Tick(object sender, EventArgs e)
{
if (m >=0 )
{
if (s == 0&&m>=1)
{
s = 60;
m--;
}
if (s >= 1)
{
s--;
}
}
label1.Text = m.ToString() + ":" + s.ToString();
if (label1.Text == tm+":"+ts)
{
SoundPlayer p = new SoundPlayer();
p.SoundLocation = Application.StartupPath + "//folder.wav";
p.Load();
p.Play();
//MessageBox.Show("还剩" + tm + "分" + ts + "秒!");
}
}
bool d = true;
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text ==""|| textBox2.Text =="")
{
MessageBox.Show("请输入时间!");
}
else
{
if (d)
{
m = int.Parse(textBox1.Text);
if (textBox2.Text == "0" || textBox2.Text == "00")
{
s = 60;
m--;
}
else
s = int.Parse(textBox2.Text);
tm = textBox3.Text;
ts = textBox4.Text;
d = false;
timer1.Enabled = true;
button1.Text = "重置";
}
else
{
d = true;
timer1.Enabled = false;
button1.Text = "开始";
label1.Text = textBox1.Text + ":" + textBox2.Text;
}
}
}
}
}
界面图如下:
- 简易计时窗口程序
- Unity3D 简易计时类
- c语言实现的简易窗口程序
- 在dos窗口演示简易聊天程序
- 程序计时
- 程序计时
- 计时程序
- 程序计时
- 到计时关闭窗口
- 使用Java实现的简易多窗口卖票程序
- 程序计时方法
- vc中的计时程序
- exit,break,程序计时
- Java程序计时
- Python程序计时
- VC计时的程序
- Python程序计时
- C++ 程序精确计时
- express+react+redux from youtube
- 编写可维护的javascript读后笔记(一)
- 使用安装在linux端的loadgenerator,在controller加载并发人数受限的问题解决
- Redis概念和集群搭建
- 终于搞懂了回车与换行的区别
- 简易计时窗口程序
- java调用vbs将word、excel文档转换成pdf
- infer运用实践
- Commander写自己的Nodejs命令
- iOS动画详解
- python 发送邮件实例
- Gson之常见的序列化与反序列化
- 【笔记】Qrcode、zxing制作二维码
- 由内部类引发的Android内存泄漏的一些思考