Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9328

cscの作法 その12

$
0
0

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

時計を作れ。

写真

image.png

サンプルコード

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());
    }
}




以上。


Viewing all articles
Browse latest Browse all 9328

Latest Images

Trending Articles