1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
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
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Timer timer = new System.Windows.Forms.Timer();
timer.Interval = 1000;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToLongTimeString();
}
}
}
|
cs |
'C#' 카테고리의 다른 글
c# winform UI스레드, Worker스레드 (0) | 2021.11.07 |
---|---|
c# winform 특정 시간마다 thread 실행하기 코드 (0) | 2021.11.07 |
c# winform backgroundworker 스레드 중단/재개하기 코드 (1) | 2021.11.06 |
c# winform chart(only for .net framework) (0) | 2021.11.06 |
c# winform listview (0) | 2021.11.05 |