C#游戲開(kāi)發(fā)之實(shí)現(xiàn)華容道游戲
實(shí)踐過(guò)程
效果

代碼
/**
* https://zhima.blog.csdn.net/
*/
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Panel pl;//記錄選中的控件ID
private void Form1_Load(object sender, EventArgs e)
{
//初始化時(shí)設(shè)置各個(gè)位置的可用狀態(tài)
PlState[0, 0] = PlState[0, 1] = PlState[0, 2] = PlState[0, 3] =
PlState[1, 0] = PlState[1, 1] = PlState[1, 2] = PlState[1, 3] =
PlState[2, 0] = PlState[2, 1] = PlState[2, 2] = PlState[2, 3] =
PlState[3, 0] = PlState[3, 1] = PlState[3, 2] = PlState[3, 3] =
PlState[4, 0] = PlState[4, 3] = true;
}
//初始化各人物方格位置
private void button1_Click(object sender, EventArgs e)
{
//設(shè)置各方格的初始圖片
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
//設(shè)置各方格的初始位置
panel1.Location = position[0, 0];
panel2.Location = position[0, 1];
panel3.Location = position[0, 3];
panel4.Location = position[2, 0];
panel5.Location = position[2, 1];
panel6.Location = position[2, 3];
panel7.Location = position[3, 1];
panel8.Location = position[3, 2];
panel9.Location = position[4, 0];
panel10.Location = position[4, 3];
PlState[4, 0] = PlState[4, 3] = true; //設(shè)置最后一行的首尾位置不可用
PlState[4, 1] = PlState[4, 2] = false; //設(shè)置最后一行的中間兩個(gè)位置可用
}
#region 趙云
private void panel1_Click(object sender, EventArgs e)
{
//設(shè)置各方格圖片
panel1.BackgroundImage = (Image)(Properties.Resources.a3);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P2V;//記錄方格樣式
pl = panel1; //記錄選中的控件ID
PosX = intX(panel1); //記錄選中控件在坐標(biāo)數(shù)組中的列索引
PosY = intY(panel1); //記錄選中控件在坐標(biāo)數(shù)組中的行索引
}
#endregion
#region 曹操
private void panel2_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources.a1);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P4;
pl = panel2;
PosX = intX(panel2);
PosY = intY(panel2);
}
#endregion
#region 張飛
private void panel3_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources.a4);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P2V;
pl = panel3;
PosX = intX(panel3);
PosY = intY(panel3);
}
#endregion
#region 馬超
private void panel4_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources.a5);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P2V;
pl = panel4;
PosX = intX(panel4);
PosY = intY(panel4);
}
#endregion
#region 關(guān)羽
private void panel5_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources.a2);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P2H;
pl = panel5;
PosX = intX(panel5);
PosY = intY(panel5);
}
#endregion
#region 黃忠
private void panel6_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources.a6);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P2V;
pl = panel6;
PosX = intX(panel6);
PosY = intY(panel6);
}
#endregion
#region 士兵一
private void panel7_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources.a7);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P1;
pl = panel7;
PosX = intX(panel7);
PosY = intY(panel7);
}
#endregion
#region 士兵二
private void panel8_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources.a8);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P1;
pl = panel8;
PosX = intX(panel8);
PosY = intY(panel8);
}
#endregion
#region 士兵三
private void panel9_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources.a9);
panel10.BackgroundImage = (Image)(Properties.Resources._010);
PStyle = PStyles.P1;
pl = panel9;
PosX = intX(panel9);
PosY = intY(panel9);
}
#endregion
#region 士兵四
private void panel10_Click(object sender, EventArgs e)
{
panel1.BackgroundImage = (Image)(Properties.Resources._003);
panel2.BackgroundImage = (Image)(Properties.Resources._001);
panel3.BackgroundImage = (Image)(Properties.Resources._004);
panel4.BackgroundImage = (Image)(Properties.Resources._005);
panel5.BackgroundImage = (Image)(Properties.Resources._002);
panel6.BackgroundImage = (Image)(Properties.Resources._006);
panel7.BackgroundImage = (Image)(Properties.Resources._007);
panel8.BackgroundImage = (Image)(Properties.Resources._008);
panel9.BackgroundImage = (Image)(Properties.Resources._009);
panel10.BackgroundImage = (Image)(Properties.Resources.a10);
PStyle = PStyles.P1;
pl = panel10;
PosX = intX(panel10);
PosY = intY(panel10);
}
#endregion
#region 判斷是否成功
///<summary>
///判斷是否成功
///</summary>
///<returns>true表示成功,false表示失敗</returns>
private bool Successful()
{
if (panel2.Location == new Point(108, 343))
{
MessageBox.Show("恭喜你,曹操已經(jīng)成功逃離華容道!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return true;
}
else
return false;
}
#endregion
//通過(guò)按鍵盤(pán)上的上、下、左、右鍵來(lái)移動(dòng)人物方格
private void Form1_KeyUp(object sender, KeyEventArgs e)
{
blUp = blDown = blLeft = blRight = false;//設(shè)置上、下、左、右方向移動(dòng)不可用
switch (e.KeyData)
{
case Keys.Up: //向上移動(dòng)
blUp = true;
break;
case Keys.Down: //向下移動(dòng)
blDown = true;
break;
case Keys.Left: //向左移動(dòng)
blLeft = true;
break;
case Keys.Right: //向右移動(dòng)
blRight = true;
break;
}
MovePosition(pl, PosX, PosY);//移動(dòng)人物方格位置
if (Successful())//判斷是否成功
button1_Click(sender, e);//重新開(kāi)始
}
//定義每個(gè)人物方格的大小, 共有x*y(x=4, y=5)個(gè)人物方格
public enum plEnumerate : int
{
plSize = 100, //人物方格大小
plX = 4, //定義列
plY = 5, //定義行
};
//判斷索引位置是否可用
public bool[,] PlState = new bool[(int)plEnumerate.plY, (int)plEnumerate.plX];
//定義一個(gè)數(shù)組,用來(lái)記錄各人物方格位置
private Point[,] position = new Point[5, 4] {
{ new Point(8, 43), new Point(108, 43), new Point(208, 43), new Point(308, 43) },
{ new Point(8, 143), new Point(108, 143), new Point(208, 143), new Point(308, 143) },
{ new Point(8, 243), new Point(108, 243), new Point(208, 243), new Point(308, 243) },
{ new Point(8, 343), new Point(108, 343), new Point(208, 343), new Point(308, 343) },
{ new Point(8, 443), new Point(108, 443), new Point(208, 443), new Point(308, 443) },
};
//獲取人物方格的位置
public Point[,] GetPosition()
{
return this.position;
}
//定義各人物方格的形狀
public enum PStyles : int
{
P1 = 0,//口
P4 = 1,//田
P2V = 2,//日
P2H = 3,//口口
};
private int m_PStyle;//獲取人物樣式的編號(hào)
//記錄人物樣式形狀
public PStyles PStyle
{
get { return (PStyles)this.m_PStyle; }
set { this.m_PStyle = (int)value; }
}
private int m_X = 0, m_Y = 0;//記錄人物方格索引
//返回人物方格列索引
public int PosX
{
get { return this.m_X; }
set { this.m_X = value; }
}
//返回人物方格行索引
public int PosY
{
get { return this.m_Y; }
set { this.m_Y = value; }
}
#region 計(jì)算選中的人物方格在數(shù)組中的列索引
///<summary>
///計(jì)算選中的人物方格在數(shù)組中的列索引
///</summary>
///<param name="pl">選中的Panel控件</param>
///<returns>列索引</returns>
private int intX(Panel pl)
{
int i = pl.Location.X - 8;
return i / 100;
}
#endregion
#region 計(jì)算選中的人物方格在數(shù)組中的行索引
///<summary>
///計(jì)算選中的人物方格在數(shù)組中的行索引
///</summary>
///<param name="pl">選中的Panel控件</param>
///<returns>行索引</returns>
private int intY(Panel pl)
{
int i = pl.Location.Y - 43;
return i / 100;
}
#endregion
//定義4個(gè)變量,分別用來(lái)表示向上、下、左、右移動(dòng)
private bool blUp, blDown, blLeft, blRight;
#region 移動(dòng)人物位置
///<summary>
///移動(dòng)人物位置
///</summary>
///<param name="pl">要移動(dòng)的控件名稱(chēng)</param>
///<param name="x">橫坐標(biāo)在坐標(biāo)數(shù)組中的索引</param>
///<param name="y">縱坐標(biāo)在坐標(biāo)數(shù)組中的索引</param>
///<returns>是否移動(dòng)成功</returns>
public bool MovePosition(Panel pl, int x, int y)
{
#region 上移
if (blUp && (y - 1) >= 0)
{
switch (PStyle)
{
case PStyles.P4://田
case PStyles.P2H://口口
if (!PlState[y - 1, x] && !PlState[y - 1, x + 1])
{
pl.Location = GetPosition()[y - 1, x];
if (PStyle == PStyles.P4)//田
{
PlState[y + 1, x] = false;
PlState[y + 1, x + 1] = false;
}
else if (PStyle == PStyles.P2H)//口口
{
PlState[y, x] = false;
PlState[y, x + 1] = false;
}
PlState[y - 1, x] = true;
PlState[y - 1, x + 1] = true;
PosY -= 1;
return true;
}
else return false;
case PStyles.P2V://日
case PStyles.P1://口
if (!PlState[y - 1, x])
{
pl.Location = GetPosition()[y - 1, x];
if (PStyle == PStyles.P2V)//日
{
PlState[y + 1, x] = false;
}
else if (PStyle == PStyles.P1)//口
{
PlState[y, x] = false;
}
PlState[y - 1, x] = true;
PosY -= 1;
return true;
}
else return false;
}
}
#endregion
#region 下移
else if (blDown)
{
switch (PStyle)
{
case PStyles.P4://田
if ((y + 2) < (int)plEnumerate.plY && !PlState[y + 2, x] && !PlState[y + 2, x + 1])
{
pl.Location = GetPosition()[y + 1, x];
PlState[y, x] = false;
PlState[y, x + 1] = false;
PlState[y + 2, x] = true;
PlState[y + 2, x + 1] = true;
PosY += 1;
return true;
}
else return false;
case PStyles.P2V://日
if ((y + 2) < (int)plEnumerate.plY && !PlState[y + 2, x])
{
pl.Location = GetPosition()[y + 1, x];
PlState[y, x] = false;
PlState[y + 2, x] = true;
PosY += 1;
return true;
}
else return false;
case PStyles.P1://口
if ((y + 1) < (int)plEnumerate.plY && !PlState[y + 1, x])
{
pl.Location = GetPosition()[y + 1, x];
PlState[y, x] = false;
PlState[y + 1, x] = true;
PosY += 1;
return true;
}
else return false;
case PStyles.P2H://口口
if ((y + 1) < (int)plEnumerate.plY && !PlState[y + 1, x] && !PlState[y + 1, x + 1])
{
pl.Location = GetPosition()[y + 1, x];
PlState[y, x] = false;
PlState[y, x + 1] = false;
PlState[y + 1, x] = true;
PlState[y + 1, x + 1] = true;
PosY += 1;
return true;
}
else return false;
}
}
#endregion
#region 左移
else if (blLeft)
{
switch (PStyle)
{
case PStyles.P2V://日
case PStyles.P4://田
if (x - 1 >= 0 && !PlState[y, x - 1] && !PlState[y + 1, x - 1])
{
pl.Location = GetPosition()[y, x - 1];
switch (PStyle)
{
case PStyles.P4://田
PlState[y, x + 1] = false;
PlState[y + 1, x + 1] = false;
break;
case PStyles.P2V://日
PlState[y, x] = false;
PlState[y + 1, x] = false;
break;
}
PlState[y, x - 1] = true;
PlState[y + 1, x - 1] = true;
PosX -= 1;
return true;
}
else return false;
case PStyles.P1://口
case PStyles.P2H://口口
if (x - 1 >= 0 && !PlState[y, x - 1])
{
pl.Location = GetPosition()[y, x - 1];
if (PStyle == PStyles.P2H)//口口
{
PlState[y, x + 1] = false;
}
else
{
PlState[y, x] = false;
}
PlState[y, x - 1] = true;
PosX -= 1;
return true;
}
else return false;
}
}
#endregion
#region 右移
else if (blRight)
{
switch (PStyle)
{
case PStyles.P4://田
if (x + 2 < (int)plEnumerate.plX && !PlState[y, x + 2] && !PlState[y + 1, x + 2])
{
pl.Location = GetPosition()[y, x + 1];
PlState[y, x] = false;
PlState[y + 1, x] = false;
PlState[y, x + 2] = true;
PlState[y + 1, x + 2] = true;
PosX += 1;
return true;
}
else return false;
case PStyles.P1://口
if (x + 1 < (int)plEnumerate.plX && !PlState[y, x + 1])
{
pl.Location = GetPosition()[y, x + 1];
PlState[y, x] = false;
PlState[y, x + 1] = true;
PosX += 1;
return true;
}
else return false;
case PStyles.P2H://口口
if (x + 2 < (int)plEnumerate.plX && !PlState[y, x + 2])
{
pl.Location = GetPosition()[y, x + 1];
PlState[y, x] = false;
PlState[y, x + 2] = true;
PosX += 1;
return true;
}
else return false;
case PStyles.P2V://日
if (x + 1 < (int)plEnumerate.plX && !PlState[y, x + 1] && !PlState[y + 1, x + 1])
{
pl.Location = GetPosition()[y, x + 1];
PlState[y, x] = false;
PlState[y + 1, x] = false;
PlState[y, x + 1] = true;
PlState[y + 1, x + 1] = true;
PosX += 1;
return true;
}
else return false;
}
}
#endregion
return false;
}
#endregion
}
partial class Form1
{
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
/// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要
/// 使用代碼編輯器修改此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel();
this.panel10 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackgroundImage = global::HuaRongDao.Properties.Resources._003;
this.panel1.Location = new System.Drawing.Point(8, 43);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(100, 200);
this.panel1.TabIndex = 0;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
//
// panel2
//
this.panel2.BackgroundImage = global::HuaRongDao.Properties.Resources._001;
this.panel2.Location = new System.Drawing.Point(108, 43);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 200);
this.panel2.TabIndex = 0;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
//
// panel3
//
this.panel3.BackgroundImage = global::HuaRongDao.Properties.Resources._004;
this.panel3.Location = new System.Drawing.Point(308, 43);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(100, 200);
this.panel3.TabIndex = 1;
this.panel3.Click += new System.EventHandler(this.panel3_Click);
//
// panel4
//
this.panel4.BackgroundImage = global::HuaRongDao.Properties.Resources._005;
this.panel4.Location = new System.Drawing.Point(8, 243);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(100, 200);
this.panel4.TabIndex = 2;
this.panel4.Click += new System.EventHandler(this.panel4_Click);
//
// panel5
//
this.panel5.BackgroundImage = global::HuaRongDao.Properties.Resources._002;
this.panel5.Location = new System.Drawing.Point(108, 243);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(200, 100);
this.panel5.TabIndex = 3;
this.panel5.Click += new System.EventHandler(this.panel5_Click);
//
// panel6
//
this.panel6.BackgroundImage = global::HuaRongDao.Properties.Resources._006;
this.panel6.Location = new System.Drawing.Point(308, 243);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(100, 200);
this.panel6.TabIndex = 4;
this.panel6.Click += new System.EventHandler(this.panel6_Click);
//
// panel7
//
this.panel7.BackgroundImage = global::HuaRongDao.Properties.Resources._007;
this.panel7.Location = new System.Drawing.Point(108, 343);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(100, 100);
this.panel7.TabIndex = 5;
this.panel7.Click += new System.EventHandler(this.panel7_Click);
//
// panel8
//
this.panel8.BackgroundImage = global::HuaRongDao.Properties.Resources._008;
this.panel8.Location = new System.Drawing.Point(208, 343);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(100, 100);
this.panel8.TabIndex = 6;
this.panel8.Click += new System.EventHandler(this.panel8_Click);
//
// panel9
//
this.panel9.BackgroundImage = global::HuaRongDao.Properties.Resources._009;
this.panel9.Location = new System.Drawing.Point(8, 443);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(100, 100);
this.panel9.TabIndex = 7;
this.panel9.Click += new System.EventHandler(this.panel9_Click);
//
// panel10
//
this.panel10.BackgroundImage = global::HuaRongDao.Properties.Resources._010;
this.panel10.Location = new System.Drawing.Point(308, 443);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(100, 100);
this.panel10.TabIndex = 8;
this.panel10.Click += new System.EventHandler(this.panel10_Click);
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.Font = new System.Drawing.Font("宋體", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(11, 9);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 25);
this.button1.TabIndex = 0;
this.button1.Text = "新游戲";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Teal;
this.ClientSize = new System.Drawing.Size(413, 550);
this.Controls.Add(this.button1);
this.Controls.Add(this.panel10);
this.Controls.Add(this.panel9);
this.Controls.Add(this.panel8);
this.Controls.Add(this.panel7);
this.Controls.Add(this.panel6);
this.Controls.Add(this.panel5);
this.Controls.Add(this.panel4);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "華容道";
this.Load += new System.EventHandler(this.Form1_Load);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.Button button1;
}
以上就是C#游戲開(kāi)發(fā)之實(shí)現(xiàn)華容道游戲的詳細(xì)內(nèi)容,更多關(guān)于C#華容道的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
WPF調(diào)用WindowsAPI實(shí)現(xiàn)屏幕錄制
這篇文章主要為大家詳細(xì)介紹了WPF如何調(diào)用WindowsAPI實(shí)現(xiàn)屏幕錄制,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)或工作有一定幫助,感興趣的小伙伴可以了解一下2023-05-05
C#中數(shù)組、ArrayList和List三者的區(qū)別詳解及實(shí)例
這篇文章主要介紹了C#中數(shù)組、ArrayList和List三者的區(qū)別詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下2016-12-12
C#函數(shù)式程序設(shè)計(jì)之用閉包封裝數(shù)據(jù)的實(shí)現(xiàn)代碼
如果一個(gè)程序設(shè)計(jì)語(yǔ)言能夠用高階函數(shù)解決問(wèn)題,則意味著數(shù)據(jù)作用域問(wèn)題已十分突出。當(dāng)函數(shù)可以當(dāng)成參數(shù)和返回值在函數(shù)之間進(jìn)行傳遞時(shí),編譯器利用閉包擴(kuò)展變量的作用域,以保證隨時(shí)能得到所需要的數(shù)據(jù)2014-03-03
C#實(shí)現(xiàn)Bitmap類(lèi)型與Byte[]類(lèi)型相互轉(zhuǎn)化的示例詳解
在C#編程中,Bitmap類(lèi)型和Byte[]類(lèi)型之間的相互轉(zhuǎn)化是圖像處理和數(shù)據(jù)傳輸中常見(jiàn)的需求,Bitmap類(lèi)型表示一個(gè)位圖圖像,而B(niǎo)yte[]類(lèi)型則是一個(gè)字節(jié)數(shù)組,本文將詳細(xì)介紹如何在這兩種類(lèi)型之間進(jìn)行相互轉(zhuǎn)化,需要的朋友可以參考下2024-07-07
C#實(shí)現(xiàn)只運(yùn)行單個(gè)實(shí)例應(yīng)用程序的方法(使用VB.Net的IsSingleInstance)
這篇文章主要介紹了C#實(shí)現(xiàn)只運(yùn)行單個(gè)實(shí)例應(yīng)用程序的方法,本文使用的是VB.Net的IsSingleInstance方法實(shí)現(xiàn),優(yōu)于Mutex 和 Process 這兩種只運(yùn)行單個(gè)應(yīng)用程序?qū)嵗姆椒?需要的朋友可以參考下2014-07-07
C#微信公眾號(hào)開(kāi)發(fā)之服務(wù)器配置
這篇文章介紹了C#微信公眾號(hào)開(kāi)發(fā)之服務(wù)器配置,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-06-06
C#在MEF框架中手動(dòng)導(dǎo)入依賴(lài)模塊
這篇文章介紹了C#在MEF框架中手動(dòng)導(dǎo)入依賴(lài)模塊的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-06-06

