连连看游戏源代码C#.docVIP

  • 25
  • 0
  • 约2.17万字
  • 约 15页
  • 2017-11-29 发布于湖北
  • 举报
连连看游戏源代码C#

连连看 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Collections; //ArrayList命名空间 namespace 连连看 { public partial class Form1 : Form { private Bitmap Source; //所有动物图案的图片 private int W = 50; //动物方块图案的宽度 private int GameSize=10; //布局大小即行列数 private bool Select_first = false; //是否已经选中第一块 private int x1, y1; //被选中第一块的地图坐标 private int x2, y2; //被选中第二块的地图坐标 Point z1, z2; //折点棋盘坐标 private int m_nCol = 10; private int m_nRow = 10; private int[] m_map = new int[10*10]; private int BLANK_STATE = -1; public enum LinkType {LineType,OneCornerType,TwoCornerType}; LinkType LType; //连通方式 public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Source = (Bitmap)Image.FromFile(..\\..\\res\\animal.bmp); this.pictureBox1.Height = W * (m_nRow + 2); this.pictureBox1.Width = W * (m_nCol+2); this.pictureBox1.Top = 0; this.pictureBox1.Left = 0; //当前窗体标题栏高度 int d = (this.Height - this.ClientRectangle.Height); this.Height = this.pictureBox1.Height + this.pictureBox1.Top+ d; this.Width = this.pictureBox1.Width + this.pictureBox1.Left ; //for (int i = 0; i 10 * 10; i++) //{ // m_map[i] = i % 6; //} StartNewGame(); Init_Graphic(); } private void StartNewGame() { //初始化地图,将地图中所有方块区域位置置为空方块状态 for(int iNum=0;iNum(m_nCol*m_nRow);iNum++) { m_map[iNum] = BLANK_STATE; }

文档评论(0)

1亿VIP精品文档

相关文档