| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 672 人关注过本帖
标题:帮忙求助
只看楼主 加入收藏
1207
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-10-23
收藏
 问题点数:0 回复次数:8 
帮忙求助
谁会编五子棋,三子棋也没关系的程序,用JAVA编,我不会,帮我
2005-10-23 11:06
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
收藏
得分:0 
用c#可以吗?

<iframe name="alimamaifrm" frameborder="0" marginheight="0" marginwidth="0" border="0" scrolling="no" width="300" height="170" src="/go/app/tbk_app/chongzhi_300_170.php?pid=mm_28854300_2441872_11377541&page=chongzhi_300_170.php&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1" ></iframe>
2005-10-23 11:55
1207
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-10-23
收藏
得分:0 
可以的,格子少一点,五个棋子的话就5*5个格子,三个棋子就3*3个,

2005-10-26 14:26
梦幻情缘
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:769
专家分:20
注 册:2005-4-4
收藏
得分:0 
如果你把思想搞懂了,想必用C#应该不是难事.
2005-10-26 20:57
1207
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-10-23
收藏
得分:0 
可是.....................唉,不懂

2005-10-27 15:17
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
收藏
得分:0 

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data;

namespace FiveStones { /// <summary> /// Form1 的摘要说明。 /// </summary> public class frmMain : System.Windows.Forms.Form { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.MenuItem menuItem7; private System.Windows.Forms.MenuItem menuItem10; private System.Windows.Forms.MainMenu mainMenu; private System.Windows.Forms.MenuItem mnuClose; private System.Windows.Forms.MenuItem mnuNew; private System.Windows.Forms.MenuItem mnuComputerFirst; private System.Windows.Forms.MenuItem mnuPersonFirst; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.Label lblBlackPlayer; private System.Windows.Forms.Label lblWhitePlayer; private System.Windows.Forms.ListBox lstHistory; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.Label lblXY; private System.Windows.Forms.MenuItem mnuAbout; private System.Windows.Forms.MenuItem mnuHelp; //定义棋盘类 private Chessboard chessboard;

public frmMain() { // // Windows 窗体设计器支持所必需的 // InitializeComponent();

// // TOD 在 InitializeComponent 调用后添加任何构造函数代码 //

//构造棋盘类 System.Drawing.Graphics g = this.CreateGraphics(); chessboard = new Chessboard(g); }

/// <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() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain)); this.mainMenu = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.mnuNew = new System.Windows.Forms.MenuItem(); this.menuItem7 = new System.Windows.Forms.MenuItem(); this.mnuPersonFirst = new System.Windows.Forms.MenuItem(); this.mnuComputerFirst = new System.Windows.Forms.MenuItem(); this.menuItem10 = new System.Windows.Forms.MenuItem(); this.mnuClose = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.mnuHelp = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.mnuAbout = new System.Windows.Forms.MenuItem(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.lstHistory = new System.Windows.Forms.ListBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.lblWhitePlayer = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.lblBlackPlayer = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.lblXY = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // mainMenu // this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem2}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuNew, this.menuItem7, this.mnuPersonFirst, this.mnuComputerFirst, this.menuItem10, this.mnuClose}); this.menuItem1.Text = "游戏(&G)"; // // mnuNew // this.mnuNew.Index = 0; this.mnuNew.Shortcut = System.Windows.Forms.Shortcut.F2; this.mnuNew.Text = "开始"; this.mnuNew.Click += new System.EventHandler(this.mnuNew_Click); // // menuItem7 // this.menuItem7.Index = 1; this.menuItem7.Text = "-"; // // mnuPersonFirst // this.mnuPersonFirst.Checked = true; this.mnuPersonFirst.Index = 2; this.mnuPersonFirst.Text = "玩家先"; this.mnuPersonFirst.Click += new System.EventHandler(this.mnuPersonFirst_Click); // // mnuComputerFirst // this.mnuComputerFirst.Index = 3; this.mnuComputerFirst.Text = "电脑先"; this.mnuComputerFirst.Click += new System.EventHandler(this.mnuComputerFirst_Click); // // menuItem10 // this.menuItem10.Index = 4; this.menuItem10.Text = "-"; // // mnuClose // this.mnuClose.Index = 5; this.mnuClose.Text = "关闭(&X)"; this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click); // // menuItem2 // this.menuItem2.Index = 1; this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mnuHelp, this.menuItem4, this.mnuAbout}); this.menuItem2.Text = "帮助(&H)"; // // mnuHelp // this.mnuHelp.Index = 0; this.mnuHelp.Shortcut = System.Windows.Forms.Shortcut.F1; this.mnuHelp.Text = "帮助"; this.mnuHelp.Click += new System.EventHandler(this.mnuHelp_Click); // // menuItem4 // this.menuItem4.Index = 1; this.menuItem4.Text = "-"; // // mnuAbout // this.mnuAbout.Index = 2; this.mnuAbout.Text = "关于(&A)"; this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.lstHistory); this.groupBox1.Location = new System.Drawing.Point(616, 8); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(160, 300); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "历史记录"; // // lstHistory // this.lstHistory.ItemHeight = 12; this.lstHistory.Location = new System.Drawing.Point(20, 22); this.lstHistory.Name = "lstHistory"; this.lstHistory.Size = new System.Drawing.Size(120, 256); this.lstHistory.TabIndex = 0; // // groupBox2 // this.groupBox2.Controls.Add(this.lblWhitePlayer); this.groupBox2.Controls.Add(this.pictureBox2); this.groupBox2.Controls.Add(this.pictureBox1); this.groupBox2.Controls.Add(this.lblBlackPlayer); this.groupBox2.Location = new System.Drawing.Point(616, 336); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(160, 144); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "玩家信息"; // // lblWhitePlayer // this.lblWhitePlayer.Font = new System.Drawing.Font("楷体_GB2312", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.lblWhitePlayer.ForeColor = System.Drawing.Color.Blue; this.lblWhitePlayer.Location = new System.Drawing.Point(56, 80); this.lblWhitePlayer.Name = "lblWhitePlayer"; this.lblWhitePlayer.Size = new System.Drawing.Size(90, 40); this.lblWhitePlayer.TabIndex = 3; this.lblWhitePlayer.Text = "电脑"; this.lblWhitePlayer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(8, 80); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(40, 40); this.pictureBox2.TabIndex = 1; this.pictureBox2.TabStop = false; // // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(8, 24); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(40, 40); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // lblBlackPlayer // this.lblBlackPlayer.Font = new System.Drawing.Font("楷体_GB2312", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.lblBlackPlayer.ForeColor = System.Drawing.Color.Red; this.lblBlackPlayer.Location = new System.Drawing.Point(56, 24); this.lblBlackPlayer.Name = "lblBlackPlayer"; this.lblBlackPlayer.Size = new System.Drawing.Size(90, 40); this.lblBlackPlayer.TabIndex = 2; this.lblBlackPlayer.Text = "玩家"; this.lblBlackPlayer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // groupBox3 // this.groupBox3.Controls.Add(this.lblXY); this.groupBox3.Location = new System.Drawing.Point(616, 504); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(160, 80); this.groupBox3.TabIndex = 2; this.groupBox3.TabStop = false; this.groupBox3.Text = "落子点"; // // lblXY // this.lblXY.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.lblXY.ForeColor = System.Drawing.Color.Red; this.lblXY.Location = new System.Drawing.Point(20, 29); this.lblXY.Name = "lblXY"; this.lblXY.Size = new System.Drawing.Size(120, 23); this.lblXY.TabIndex = 0; this.lblXY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // frmMain // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(792, 566); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximumSize = new System.Drawing.Size(800, 650); this.Menu = this.mainMenu; this.MinimumSize = new System.Drawing.Size(800, 650); this.Name = "frmMain"; this.Text = "C#版五子棋"; this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmMain_MouseDown); this.Load += new System.EventHandler(this.frmMain_Load); this.Paint += new System.Windows.Forms.PaintEventHandler(this.frmMain_Paint); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.frmMain_MouseMove); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.ResumeLayout(false);

} #endregion

/// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new frmMain()); }

private void frmMain_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { //绘制棋盘内容 chessboard.Draw(); }

private void frmMain_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { //人下棋子 chessboard.PersonDownStone(e.X,e.Y); //显示历史记录 Array arr = chessboard.StarckHistory.ToArray(); lstHistory.DataSource = arr; }

private void frmMain_Load(object sender, System.EventArgs e) { //初始载入默认玩家先 chessboard.Start(false); }

//显示落子点的位置 private void frmMain_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.X < 600 && e.Y < 600) { //取下棋点 int m = (int)Math.Floor(e.X/40); int n = (int)Math.Floor(e.Y/40); lblXY.Text = "X:"+m.ToString()+" Y:"+n.ToString(); } }

#region 游戏菜单操作 //开始 private void mnuNew_Click(object sender, System.EventArgs e) { if (mnuPersonFirst.Checked) { chessboard.Start(false); } else { chessboard.Start(true); } }

//玩家先 private void mnuPersonFirst_Click(object sender, System.EventArgs e) { mnuPersonFirst.Checked = true; mnuComputerFirst.Checked = false; lblBlackPlayer.Text = "玩家"; lblWhitePlayer.Text = "电脑"; chessboard.Start(false); }

//电脑先 private void mnuComputerFirst_Click(object sender, System.EventArgs e) { mnuPersonFirst.Checked = false; mnuComputerFirst.Checked = true; lblBlackPlayer.Text = "电脑"; lblWhitePlayer.Text = "玩家"; chessboard.Start(true); }

//关闭 private void mnuClose_Click(object sender, System.EventArgs e) { this.Close(); } #endregion

#region 帮助菜单操作 //帮助 private void mnuHelp_Click(object sender, System.EventArgs e) { try { System.Diagnostics.Process.Start("help.chm"); } catch { MessageBox.Show("未找到帮助文件!"); } }

//关于 private void mnuAbout_Click(object sender, System.EventArgs e) { frmAbout frmabout = new frmAbout(); frmabout.Show(); } #endregion } }


<iframe name="alimamaifrm" frameborder="0" marginheight="0" marginwidth="0" border="0" scrolling="no" width="300" height="170" src="/go/app/tbk_app/chongzhi_300_170.php?pid=mm_28854300_2441872_11377541&page=chongzhi_300_170.php&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1" ></iframe>
2005-10-27 22:43
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
收藏
得分:0 

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms;

namespace FiveStones { /// <summary> /// frmAbout 的摘要说明。 /// </summary> public class frmAbout : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnClose; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label2; private System.Windows.Forms.LinkLabel lkbEmail; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null;

public frmAbout() { // // Windows 窗体设计器支持所必需的 // InitializeComponent();

// // TOD 在 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() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmAbout)); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.btnClose = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label2 = new System.Windows.Forms.Label(); this.lkbEmail = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(16, 17); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(51, 50); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // label1 // this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134))); this.label1.Location = new System.Drawing.Point(80, 17); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(192, 50); this.label1.TabIndex = 1; this.label1.Text = "C#版五子棋\n作者:二十四画生\n版本:1.0.0"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // btnClose // this.btnClose.Location = new System.Drawing.Point(196, 160); this.btnClose.Name = "btnClose"; this.btnClose.TabIndex = 2; this.btnClose.Text = "确定(&Q)"; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // groupBox1 // this.groupBox1.Location = new System.Drawing.Point(16, 136); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(260, 8); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; // // label2 // this.label2.Location = new System.Drawing.Point(16, 81); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(260, 31); this.label2.TabIndex = 4; this.label2.Text = "本软件为免费软件,可任意传播复制。若需本软件源码请与作者联系。"; // // lkbEmail // this.lkbEmail.LinkArea = new System.Windows.Forms.LinkArea(6, 19); this.lkbEmail.Location = new System.Drawing.Point(16, 112); this.lkbEmail.Name = "lkbEmail"; this.lkbEmail.Size = new System.Drawing.Size(260, 23); this.lkbEmail.TabIndex = 5; this.lkbEmail.TabStop = true; this.lkbEmail.Text = "Email:esshs@tom.com"; this.lkbEmail.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lkbEmail_LinkClicked); // // frmAbout // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(292, 193); this.Controls.Add(this.lkbEmail); this.Controls.Add(this.label2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.btnClose); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "frmAbout"; this.ShowInTaskbar = false; this.Text = "关于 C#版五子棋"; this.ResumeLayout(false);

} #endregion

private void btnClose_Click(object sender, System.EventArgs e) { this.Close(); }

private void lkbEmail_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start("mailtesshs@tom.com"); }

} }


<iframe name="alimamaifrm" frameborder="0" marginheight="0" marginwidth="0" border="0" scrolling="no" width="300" height="170" src="/go/app/tbk_app/chongzhi_300_170.php?pid=mm_28854300_2441872_11377541&page=chongzhi_300_170.php&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1" ></iframe>
2005-10-27 22:44
lpx
Rank: 1
等 级:新手上路
帖 子:163
专家分:0
注 册:2005-4-24
收藏
得分:0 
不少呀,值得研究

我还在编程路上转悠,偶而看到一两盏灯不是为我而亮
2005-10-28 15:58
1207
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-10-23
收藏
得分:0 

是呀,这么长的啊


2005-10-28 21:44
快速回复:帮忙求助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034770 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved