Form1.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 俄罗斯方块
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Game game=null;
private void button1_Click(object sender, EventArgs e)
{
game= new Game();
pictureBox1.Height = Game.BlockImageHeight * Game.PlayingFieldHeight + 3;
pictureBox1.Width = Game.BlockImageWidth * Game.PlayingFieldWidth+3;
pictureBox1.Invalidate();//重画游戏面板区域
timer1.Enabled = true;
button1.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
if (button2.Text == "暂停游戏")
{
timer1.Enabled = false; button2.Text = "继续游戏";
}
else
{
timer1.Enabled = true; button2.Text = "暂停游戏";
}
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
//重画游戏面板
if (game != null)
{
game.DrawPile(e.Graphics);
game.DrawCurrentBlock(e.Graphics);
}
}
private void pictureBox2_Paint(object sender, PaintEventArgs e)
{
////重画下一个方块
if (game != null) game.DrawNextBlock(e.Graphics);
}
private void timer1_Tick(object sender, EventArgs e)
{
if (!game.DownCurrentBlock())
{
pictureBox1.Invalidate();//重画游戏面板区域
后面还有 53 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
