概要
cscの作法、調べてみた。
練習問題やってみた。
練習問題
時計を作れ。
写真
サンプルコード
using System;
using System.Windows.Forms;
using System.Drawing;
class form1: Form {
Label la1;
form1() {
Text = "Timer";
ClientSize = new Size(300, 200);
la1 = new Label();
la1.Location = new Point(50, 50);
la1.Text = "test";
Controls.AddRange(new Control[] {
la1
});
Timer timer = new Timer();
timer.Interval = 1000;
timer.Tick += new EventHandler(timerTick);
timer.Start();
}
void timerTick(object sender, EventArgs e) {
la1.Text = DateTime.Now.ToString("HH:mm:ss");
}
[STAThread]
public static void Main() {
Application.Run(new form1());
}
}
以上。