-
Timer 사용C#/WindowForm 2022. 4. 6. 11:17
디자인 실행코드
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 _29 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { label1.Location = new Point(ClientSize.Width / 2 - label1.Width / 2,ClientSize.Height / 2 - label1.Height / 2); label1.Font = new Font("휴먼굴림체", 30, FontStyle.Bold); label1.ForeColor = Color.Blue; label1.Text = ""; timer1.Interval = 1000; timer1.Tick += Timer1_Tick; timer1.Start(); } private void Timer1_Tick(object sender, EventArgs e) { label1.Text = DateTime.Now.ToString(); label1.Location = new Point(ClientSize.Width / 2 - label1.Width / 2,ClientSize.Height / 2 - label1.Height / 2); } } }
결과 'C# > WindowForm' 카테고리의 다른 글
ACCESS를 사용한 DB연결 -3 (PhoneBook) (0) 2022.05.18 dataTimePicker (0) 2022.04.06 ComboBox를 사용한 학점 계산기 (0) 2022.04.06 ListBox (0) 2022.04.06 ComboBox (0) 2022.04.06