当前上下文不存在名称“InitializeComponent”怎么解决啊?!
刚开始学习C#,很多都不会啊,请问这个问题怎么解决啊?
调试后出现当前上下文不存在名称“InitializeComponent”
请问怎么解决这个问题啊?
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Thing
{public partial class Thing : Form
{public Thing()
{
InitializeComponent();
}
private void Thing_Paint(object sender,PaintEventArgs e)
{
const int mid=150;
const int top=50;
this.BackColor=Color.Cyan;
this.Width=310;
this.Height=260;
this.Text="Simple Graphics Thing";
Pen blue=new Pen(Color.Blue);
Pen yellow=new Pen(Color.Yellow);
Pen white=new Pen(Color.White);
Pen black=new Pen(Color.Black);
Brush brWhite=white.Brush;
Brush brBlack=black.Brush;
Graphics g=e.Graphics;
g.DrawRectangle(blue,0,175,300,50);
g.DrawEllipse(yellow,-40,-40,80,80);
g.FillEllipse(brWhite,mid-20,top,40,40);
g.FillEllipse(brWhite,mid-35,top+35,70,50);
g.FillEllipse(brWhite,mid-50,top+80,100,60);
g.FillEllipse(brBlack,mid-10,top+10,5,5);
g.FillEllipse(brBlack,mid+5,top+10,5,5);
g.DrawArc(black,mid-10,top+20,20,10,-190,-160);
g.DrawLine(black,mid-25,top+60,mid-50,top+40);
g.DrawLine(black,mid+25,top+60,mid+55,top+60);
g.DrawLine(black,mid-20,top+5,mid+20,top+5);
g.FillRectangle(brBlack,mid-15,top-20,30,25);
}
}
}