SolidBrush hb1=new SolidBrush(Color.Black);
SolidBrush hb2=new SolidBrush(Color.White);
SolidBrush hb3=new SolidBrush(Color.BurlyWood);
bool b=true,b1=false,b2=true;
int x,y,hqizi,bqizi;
int black=0,white=0;
int [,]xy=new int[12,12];
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label l1;
private System.Windows.Forms.Label l2;
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.Label label3;
private System.Windows.Forms.Label l3;
private System.Windows.Forms.Label l4;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.Label label4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
xy[5,5]=1;
xy[5,6]=-1;
xy[6,5]=-1;
xy[6,6]=1;
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.l1 = new System.Windows.Forms.Label();
this.l2 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.label3 = new System.Windows.Forms.Label();
this.l3 = new System.Windows.Forms.Label();
this.l4 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 18F);
this.label1.ForeColor = System.Drawing.SystemColors.Desktop;
this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label1.Location = new System.Drawing.Point(408, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 32);
this.label1.TabIndex = 0;
this.label1.Text = "黑方";
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 12F);
this.label2.ForeColor = System.Drawing.SystemColors.InfoText;
this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label2.Location = new System.Drawing.Point(408, 136);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 24);
this.label2.TabIndex = 1;
this.label2.Text = "黑棋数:";
//
// l1
//
this.l1.Font = new System.Drawing.Font("宋体", 12F);
this.l1.ForeColor = System.Drawing.SystemColors.InfoText;
this.l1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.l1.Location = new System.Drawing.Point(480, 136);
this.l1.Name = "l1";
this.l1.Size = new System.Drawing.Size(40, 24);
this.l1.TabIndex = 2;
this.l1.Text = "2";
//
// l2
//
this.l2.Font = new System.Drawing.Font("宋体", 12F);
this.l2.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.l2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.l2.Location = new System.Drawing.Point(480, 272);
this.l2.Name = "l2";
this.l2.Size = new System.Drawing.Size(40, 24);
this.l2.TabIndex = 5;
this.l2.Text = "2";
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋体", 18F);
this.label5.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label5.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label5.Location = new System.Drawing.Point(408, 216);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 32);
this.label5.TabIndex = 4;
this.label5.Text = "白方";
//
// label6
//
this.label6.Font = new System.Drawing.Font("宋体", 12F);
this.label6.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label6.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label6.Location = new System.Drawing.Point(408, 272);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 24);
this.label6.TabIndex = 3;
this.label6.Text = "白棋数:";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItem6});
this.menuItem1.Text = "菜单";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "重新开始";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "重新计分";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "退出";
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5});
this.menuItem4.Text = "关于";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.Text = "游戏说明";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 12F);
this.label3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label3.Location = new System.Drawing.Point(448, 368);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(16, 24);
this.label3.TabIndex = 6;
this.label3.Text = ":";
//
// l3
//
this.l3.Font = new System.Drawing.Font("宋体", 12F);
this.l3.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.l3.Location = new System.Drawing.Point(408, 368);
this.l3.Name = "l3";
this.l3.Size = new System.Drawing.Size(32, 24);
this.l3.TabIndex = 7;
this.l3.Text = "0";
//
// l4
//
this.l4.Font = new System.Drawing.Font("宋体", 12F);
this.l4.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.l4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.l4.Location = new System.Drawing.Point(480, 368);
this.l4.Name = "l4";
this.l4.Size = new System.Drawing.Size(32, 24);
this.l4.TabIndex = 8;
this.l4.Text = "0";
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 12F);
this.label4.ForeColor = System.Drawing.SystemColors.Desktop;
this.label4.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label4.Location = new System.Drawing.Point(408, 320);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 32);
this.label4.TabIndex = 9;
this.label4.Text = "分数";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.BurlyWood;
this.ClientSize = new System.Drawing.Size(536, 438);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.l4);
this.Controls.Add(this.l3);
this.Controls.Add(this.l2);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.l1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(544, 472);
this.Menu = this.mainMenu1;
this.MinimumSize = new System.Drawing.Size(544, 472);
this.Name = "Form1";
this.Text = "黑白棋";
this.MouseUp
+= new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.MouseEnter += new System.EventHandler(this.Form1_MouseEnter);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
//鼠标移入窗体发生的事件
private void Form1_MouseEnter(object sender, System.EventArgs e)
{
h_qipan();
qizi();
}
//鼠标操作 下棋子
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.X<=40||e.X>=390||e.Y<=40||e.Y>=390)
return;
x=(e.X-e.X%30)/30-1;
y=(e.Y-e.Y%30)/30-1;
if(xy[x,y]==0)
{
if(b==true)
x_qizi(1);
else
x_qizi(-1);
}
qizi_s();
qizi();
s_y();
}
//重新开始 初始化棋盘
private void menuItem2_Click(object sender, System.EventArgs e)
{
ch_qipan();
}
//重新计分
private void menuItem3_Click(object sender, System.EventArgs e)
{
l3.Text="0";
l4.Text="0";
black=0;
white=0;
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
MessageBox.Show("\n
游戏很简单,如果不按照规则是下不了棋的。\n\n游戏规则:\n在你要下棋子的地方必须满足上下左右8个方向至少有一粒自己的棋子,\n而且中间不能有
空位,若中间是对方棋子就会被吃掉(边成你的棋子)。\n\n
制作 不锈钢","说明");
}
private void menuItem6_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}