Form1.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 贪吃蛇
{
public partial class Form1 : Form
{
public static Graphics 图;
贪吃蛇 snake = new 贪吃蛇();
public Form1()
{
InitializeComponent();
图 = this.panel1.CreateGraphics();
timer1.Enabled = false;
}
public void gameover()
{
MessageBox.Show(this, "游戏结束!", "游戏结束", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void button1_Click(object sender, EventArgs e)
{
if (!snake.start)
{
if (comboBox1.SelectedIndex == -1)
timer1.Interval = 300;
else
timer1.Interval = 300 - 27 * comboBox1.SelectedIndex;
timer1.Enabled = true;
snake.start = true;
button1.Text = "暂停";
}
else
{
timer1.Enabled = false;
snake.start = false;
button1.Text = "继续";
}
}
// 下载于www.51aspx.com
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case 'w':
snake.move(way.up);
break;
case 's':
snake.move(way.down);
后面还有 43 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。