怎样才能使贪吃蛇动?
这是我的代码目前只画了3个方块:using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int i = 0;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (i == 1)
{
Double d = 6;
this.Opacity -= d / 100;
if (Opacity == 0)
{
this.Close();
}
}
}
private void button2_Click(object sender, EventArgs e)
{
i = 1;
}
private void timer2_Tick(object sender, EventArgs e)
{
Graphics form = pictureBox1.CreateGraphics();
SolidBrush bursh = new SolidBrush(Color.Black);
int number = 0;
this.Refresh();
for (int a = 0; a < 3; a++)
{
form.FillRectangle(bursh, 10 + number, 10, 5, 5);
number += 6;
}
}
private void button1_Click(object sender, EventArgs e)
{
timer2.Start();
}
}
}