统一归档20260319
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
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 _15_4
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
long ticks = 0;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (button1.Text == "开始")
|
||||
{
|
||||
button1.Text = "暂停";
|
||||
timer1.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
button1.Text = "开始";
|
||||
timer1.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
button1.Text = "开始";
|
||||
timer1.Stop();
|
||||
Timer.Text = "00:00:00:00";
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
ticks++;
|
||||
long hours = ticks / 360000;
|
||||
long minutes = (ticks - hours * 360000) / 6000;
|
||||
long seconds = (ticks - hours * 360000 - minutes * 6000) / 100;
|
||||
long ms = ticks - hours * 360000 - minutes * 6000 - seconds * 100;
|
||||
Timer.Text = string.Format("{0:00}:{1:00}:{2:00}:{3:00}",hours,minutes,seconds,ms);
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
ticks = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user