デジタルクロックを作ってみようと思い、フォーム上にラベルとタイマーを追加しコードを以下のようにすると
ビルドやデバッグ開始ではエラーも警告もなく起動するのですが、コンパイルしようとすると「InitializeComponent」「timer1」「label1」は
現在のコンテキスト内に存在しません。とエラーが出るのですがこれは何が間違っているのでしょうか?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DigitalClock
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void timer1_Tick(object sender, EventArgs e)
{
this.label1.Text = System.DateTime.Now.ToLongTimeString();
}
}
}