C#Windows窗体应用程序设计(完结篇)-----俄罗斯方块的实现

C# windows窗体应用程序设计

本系列最后一篇,以后不会再以博文的方式呈现。


前言

因为疫情的原因,再加上进入到大三,考证、学业繁忙。加上还要考研的目标,断更了很久。各位看我文章入坑的小伙伴,先说一声抱歉。我想做很多系列,列了很多规划,但这一切都被改变得太快。(本来打算大二上期复习考证等一些列计划全推到本学期,再加上本学期各种专业认知实习)所以后面有些系列更新很慢甚至几乎不会再更新了。在我规划好了时间后,我决定每周末来给大家更新,周末我是专门留着搞其他事情的,其他时间就专心学业和考试。我争取做到每周一更。觉得需要取关的可以取关,我理解。更新强度达不到之前的样子,不能实现之前的规划蓝图。总之,感谢大家的支持。


以下是本篇文章正文内容

一、俄罗斯方块的实现

俄罗斯方块是一款比较经典的游戏,即使没玩过是有听说过的,现在一些节目魔改了俄罗斯方块的玩法,给大家带来了更多的乐趣。现在,动动你的小脑袋,一起来写一个简易的俄罗斯方块游戏吧。
1

二、步骤

1.部分函数代码

主函数代码如下:

namespace Tetris
{
   
   
    partial class frmMain
    {
   
   
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
   
   
            if (disposing && (components != null))
            {
   
   
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
   
   
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
            this.label4 = new System.Windows.Forms.Label();
            this.btnStop = new System.Windows.Forms.Button();
            this.btnStart = new System.Windows.Forms.Button();
            this.lblScore = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.pbNextBlock = new System.Windows.Forms.PictureBox();
            this.pbMain = new System.Windows.Forms.PictureBox();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.musicPlayer = new AxWMPLib.AxWindowsMediaPlayer();
            ((System.ComponentModel.ISupportInitialize)(this.pbNextBlock)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pbMa
C#做的俄罗斯方块游戏using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Xml; using System.IO; using System.Security.Cryptography; using System.Text; using System.Runtime.Serialization.Formatters.Binary; namespace RussiaBlock { public class MainForm : System.Windows.Forms.Form { #region 变量 private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Timer timer1; private Block block; private Block nextBlock; private int nextShapeNO; private bool paused; private DateTime atStart; private DateTime atPause; private TimeSpan pauseTime; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.TextBox textBox1; private ControlForm sform; private Keys[] keys; private System.Windows.Forms.Label label4; private int level; private int startLevel; private bool trans; private int rowDelNum; private bool failed; private System.Windows.Forms.Label label5; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.MenuItem menuItem5; private System.Windows.Forms.MenuItem menuItem6; private AxWMPLib.AxWindowsMediaPlayer axMediaPlayer1; private System.Windows.Forms.MenuItem menuItem7; private System.ComponentModel.IContainer components; #endregion public MainForm() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if(component
评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

思维矩阵K

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值