• 大小: 0.03M
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2021-02-23
  • 语言: C#
  • 标签: C#  验证  

资源简介

本例将常用的几种计时方式都进行了尝试,并通过测试了解了各种计时的应用区别,方便后续的应用!代码里还有详细的解释说明,方便使用!

资源截图

代码片段和文件信息

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.Diagnostics;//提供一组方法和属性,可用于准确地测量运行时间只有引用后Stopwatch类才能使用
using System.Threading;//创建和控制线程,设置其优先级并获取其状态。

namespace 秒表计时器
{
    public partial class Form1 : Form
    {
        private BackgroundWorker demoBGWorker = new BackgroundWorker();

        public Form1()
        {
            InitializeComponent();


        }

        private void Form1_Load(object sender EventArgs e)
        {
            timer1.Enabled = false;
            timer1.Interval = 500;
        }

        int timerDrawI = 0;
        float timerDrawF = 0;
        private void timer1_Tick(object sender EventArgs e)
        {
            timerDrawI++;
            timerDrawF = timerDrawI / 2;
            textBox_ms.Text = Convert.ToString(timerDrawI);
            textBox_sec.Text = Conver

评论

共有 条评论