问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
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 Timer
{
public partial class Form1 : Form
{
long count = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void buttonStart_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void buttonStop_Click(object sender, EventArgs e)
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
count++;
long hour = count / 3600000;
long min = (count - hour * 3600000)/60000;
long s = (count - hour * 3600000 - min * 60000)/1000;
long ms = (count - hour * 3600000 - min * 60000-s*1000)/1;
label1.Text = String.Format("{0:00}:{1:00}:{2:00}:{3:00}", hour, min, s, ms);
}
}