完整程序包已经上传至我的down
http://download.youkuaiyun.com/detail/xuptacm/9835025
这里是界面设计
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
System.Diagnostics.Stopwatch sw;
private void button2_Click(object sender, EventArgs e)
{
sw.Start();
timer1.Start();
}
private void button1_Click(object sender, EventArgs e)
{
sw = new System.Diagnostics.Stopwatch();
sw.Start();
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
TimeSpan ts = sw.Elapsed;
label.Text = string.Format("{0}日:{1}时:{2}分:{3}秒:{4}毫秒", ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
}
private void button3_Click(object sender, EventArgs e)
{
string[] sMystring;
OpenFileDialog ofdMyofd = new OpenFileDialog();
// ofdMyofd.FileName = "Please Select Picture";
ofdMyofd.Filter = "b.jpg|*.*";
if (ofdMyofd.ShowDialog() == DialogResult.OK)
{
sMystring = ofdMyofd.FileNames;
this.BackgroundImage = Image.FromFile(sMystring[0]);
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
sw.Stop();
TimeSpan ts = sw.Elapsed;
label.Text = string.Format("{0}日:{1}时:{2}分:{3}秒:{4}毫秒", ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
listBox1.Items.Add(label.Text);
// this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
// this.listBox1.SelectedIndex = -1;
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void label1_Click_1(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
label.Text = "00:00:00";
}
}
}