C# timer添加事件处理
发布日期:2021-06-30 12:05:56 浏览次数:2 分类:技术文章

本文共 718 字,大约阅读时间需要 2 分钟。

代码如下:

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)        {            this.timer1.Interval = 100;            this.timer1.Enabled = true;            label1.Text = DateTime.Now.ToString();        }        private void time(object sender, EventArgs e)        {            label1.Text = DateTime.Now.ToString();        }          }    }

添加过程:

在这里插入图片描述

执行结果如下:

在这里插入图片描述

转载地址:https://jackzhang.blog.csdn.net/article/details/83049457 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:C# menuItem使用
下一篇:C# linklabel使用

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年05月01日 00时37分27秒