我在2010年视觉演播室上设立了以下课程:
public class Bat : Form1
{
public int BatLocation;
public void draw()
{
Pen batPen = new Pen(Color.Black);
batPen.Width = 10;
playArea.DrawRectangle(batPen, BatLocation, (picPlayArea.Height - 30), 50, 10);
}
}
但是,当我试图为这几类人树立榜样时,我却遇到一种 st然的过度现象,我建议我确保我不会有无限的 lo或无限的再次入侵。 我试图以以下两种不同方式创建这个案例:
Bat bottomBat;
bottomBat = new Bat();
以及
Bat bottomBat = new Bat();
But both ways return the same error when I try to run the program. I ve also tried the class definition with 以及 without the public
modifier.
I m pretty new to programming 以及 have no idea what might be causing this problem. Am I doing something wrong?
<><>Edit>: <代码> Bat 类别是我目前拥有的一切,为它创造了一个特定建筑。 我认为我是否需要吗?
无论如何,这里是表格1的整类:
public partial class Form1 : Form
{
// Define various objects for the game
public Graphics playArea;
Bat bottomBat = new Bat();
public Form1()
{
InitializeComponent();
// Create instances of objects
playArea = picPlayArea.CreateGraphics();
//bottomBat = new Bat();
// Delegate the mouseMove event for picPlayArea
picPlayArea.MouseMove += new MouseEventH以及ler(picPlayArea_MouseMove);
}
private void picPlayArea_MouseMove(object sender, MouseEventArgs e)
{
bottomBat.Location = e.X;
}
private void btnExit_Click(object sender, EventArgs e)
{
string msg = "Are you sure you want to exit?",
title = "Confirm Exit";
DialogResult res = MessageBox.Show(msg, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (res == DialogResult.Yes)
{
Environment.Exit(0);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
// This is where most of the functionality is executed within the game
playArea.Clear(Color.White);
}
private void btnStart_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
}