首页

C#版中国象棋游戏源代码 完整实例下载

c#

2020-8-25

C# 中国象棋游戏,仅供学习交流使用,请勿用于商业用途

public void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{//方法功能:画旗盘
			Graphics g=e.Graphics;
			int startLeft,startTop;
			if(this.displaySize==15)
			{
				startLeft=48;startTop=32;//左上角点	 800*600
			}
			else
			{
				startLeft=60;startTop=35;//左上角点 1024*768
			}
			int Index=0; //记录点的索引			
			width=panel1.Width;
			height=panel1.Height;
			width=width/9;  height=height/10;  //确定每个方格的宽和高
			width-=4; height-=3;			
			Pen pen1=new Pen(Color.DarkBlue,3);	
			Pen pen2=new Pen(Color.Black,2);
			int startX=startLeft,startY=startTop;
			for(int i=0;i<2;i  )
			{
				for(int j=0;j<4;j  )
				{
					for(int k=0;k<8;k  )
					{//以下括号内所有语句为画一行方格						
						g.DrawRectangle(pen1,startX,startY,width,height);						
						point[Index]=new Point(startX,startY);
						Index  ;
						startX =width;
					}					
					point[Index]=new Point(point[Index-1].X width,point[Index-1].Y);
					Index  ;
					
					startY =height;  //往下移动动坐标,画下一行方格
					startX=startLeft;
				}				
				//记录上面忘下的九个点
				for(int ii=Index-9,j=0;j<9;ii  ,j  )
				{					
					point[Index]=new Point(point[ii].X,point[ii].Y height);
					Index  ;
				}
				int paoX,paoY;  //声明画炮点的漂亮图案坐标
				int x,y,temp;   //画将/帅的辅助变量
				if(i==0)
				{
					paoX=startLeft width;
					paoY=startTop 2*height;							
					x=startLeft 3*width;
					y=startTop 2*height;
					temp=0;					
				}
				else
				{
					paoX=startLeft width;
					paoY=startTop 7*height height/2;					
					x=startLeft 3*width;
					y=startLeft 9*height 2;
					temp=7*height height/2 2;
				}				
				
				//画横向的两个炮的漂亮图案
				DrawAllSitePoint(sender,e,paoX,paoY,width);		
				paoX=startLeft 7*width;
				DrawAllSitePoint(sender,e,paoX,paoY,width);	
                
				//画将/帅家					
				float[] dashValues={3,1,3,1,3,1};
				pen2.DashPattern=dashValues;
				g.DrawLine(pen2,x,startTop temp,x 2*width,y);
				x=startLeft 5*width;
				g.DrawLine(pen2,x,startTop temp,x-2*width,y);

				//画中间的河				
				Font font=new Font("华文行楷", 42F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));                				
				Brush brush=new SolidBrush(Color.Purple);
				PointF tempPoint=new PointF(startLeft,startTop 4*height 10);
				string tempStr;
				if(this.displaySize==15)
				{
					tempStr="  楚   河       汉   界     "; /************适于800*600 分辩率**************/
				}
				else
				{
					tempStr="      楚    河           汉    界     ";   /************适于1024*768分辩率**************/
					tempPoint.Y=tempPoint.Y 8;
				}
				g.DrawString(tempStr,font,brush,tempPoint);

				startX=startLeft;
				startY=startTop 5*height height/2;	//移动坐标,画下方旗盘		    
			}			
			for(int i=29;i<=33;i =2)
				DrawAllSitePoint(sender,e,this.point[i].X,this.point[i].Y,width);
			for(int i=56;i<=60;i =2)
				DrawAllSitePoint(sender,e,this.point[i].X,this.point[i].Y,width);
			this.DrawLeftHalfSitePoint(sender,e,this.point[27].X,this.point[27].Y,width);
			this.DrawRightHalfSitePoint(sender,e,this.point[35].X,this.point[35].Y,width);
			this.DrawLeftHalfSitePoint(sender,e,this.point[54].X,this.point[54].Y,width);
			this.DrawRightHalfSitePoint(sender,e,this.point[62].X,this.point[62].Y,width);

			pen1.Dispose();
			g.Dispose();	
			MyInitializeComponent();
			
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
            this.panel1.Cursor = new Cursor(@"..\..\cursor\greenflag.cur");
            this.label7.Cursor = new Cursor(@"..\..\cursor\greenflag.cur");
            this.label8.Cursor = new Cursor(@"..\..\cursor\greenflag.cur");
			this.pictureBox1.Cursor=new Cursor(@"..\..\cursor\heart.cur");
			this.pictureBox3.Cursor=new Cursor(@"..\..\cursor\heart.cur");
			this.pictureBox4.Cursor=new Cursor(@"..\..\cursor\heart.cur");
			this.pictureBox5.Cursor=new Cursor(@"..\..\cursor\heart.cur");	
			MyInitializeComponent();

			//布置
			this.panel1.Width=this.Width-this.panel2.Width;
			this.panel1.Height=this.Height-this.statusBar1.Height-52;
			this.panel2.Left=this.Left this.panel1.Width;
			this.panel2.Height=this.panel1.Height;
			this.panel2.Width=this.Width-this.panel1.Width;	
		
			login=new Form3();
			/*if(login.ShowDialog()==DialogResult.OK)
			{
				label1.Text=login.textBox1.Text.ToString() " VS " login.textBox2.Text.ToString();								
				if(login.radioButton1.Checked)
					this.computerAuto=true;
				login.Close();
			}
			else
				login.Close();	
		
			playName[1]="女孩"; playName[2]="男孩";
			playName[3]=login.textBox1.Text.ToString();
			playName[4]=login.textBox2.Text.ToString();					*/
		}

		private void panel1_Resize(object sender, System.EventArgs e)
		{			
			MyInitializeComponent();
		}

		private void label1_DoubleClick(object sender, System.EventArgs e)
		{			
			string tempStr;
			tempStr=playName[1];
			playName[1]=playName[3];
			playName[3]=tempStr;
			tempStr=playName[2];
			playName[2]=playName[4];
			playName[4]=tempStr;

			label1.Text=playName[3];
			label1.Text =" VS " playName[4];
			login.textBox1.Text=playName[3];
			login.textBox2.Text=playName[4];
			
			//this.blueZhanJi=0;
			//this.redZhanJi=0;
			//this.statusBarPanel2.Text="红方: 0";
			//this.statusBarPanel3.Text="蓝方: 0";
		}
资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
源码05 象棋游戏/App.ico , 10614
源码05 象棋游戏/AssemblyInfo.cs , 1859
源码05 象棋游戏/bin/Release/app.publish/Application Files/双人象棋游戏_1_0_0_0/App.ico.deploy , 10614
源码05 象棋游戏/bin/Release/app.publish/Application Files/双人象棋游戏_1_0_0_0/AxInterop.WMPLib.dll.deploy , 53248
源码05 象棋游戏/bin/Release/app.publish/Application Files/双人象棋游戏_1_0_0_0/Interop.WMPLib.dll.deploy , 274432
源码05 象棋游戏/bin/Release/app.publish/Application Files/双人象棋游戏_1_0_0_0/双人象棋游戏.exe.deploy , 233472
源码05 象棋游戏/bin/Release/app.publish/Application Files/双人象棋游戏_1_0_0_0/双人象棋游戏.exe.manifest , 8404
源码05 象棋游戏/bin/Release/app.publish/setup.exe , 475568
源码05 象棋游戏/bin/Release/app.publish/双人象棋游戏.application , 5359
源码05 象棋游戏/bin/Release/AxInterop.WMPLib.dll , 53248
源码05 象棋游戏/bin/Release/Interop.WMPLib.dll , 339968
源码05 象棋游戏/bin/Release/双人象棋游戏.exe , 233472
源码05 象棋游戏/bin/Release/双人象棋游戏.pdb , 128512
源码05 象棋游戏/bin/Release/双人象棋游戏.vshost.exe , 14328
源码05 象棋游戏/bin/Release/双人象棋游戏.vshost.exe.manifest , 490
源码05 象棋游戏/bkground/BOY.GIF , 12155
源码05 象棋游戏/bkground/GIRL.GIF , 6869
源码05 象棋游戏/bkground/heart.GIF , 4939
源码05 象棋游戏/bkground/STAR2.GIF , 4939
源码05 象棋游戏/ComputerBrainpower.cs , 16638
源码05 象棋游戏/cursor/finger.cur , 2238
源码05 象棋游戏/cursor/finger1.cur , 2238
源码05 象棋游戏/cursor/greenflag.cur , 2238
源码05 象棋游戏/cursor/harrow.cur , 766
源码05 象棋游戏/cursor/heart.cur , 2238
源码05 象棋游戏/cursor/hmove.cur , 766
源码05 象棋游戏/cursor/hold.cur , 766
源码05 象棋游戏/cursor/OK1.cur , 2238
源码05 象棋游戏/cursor/OK2.cur , 2238
源码05 象棋游戏/cursor/stop.cur , 766
源码05 象棋游戏/FlagContainer.cs , 5375
源码05 象棋游戏/FlagMoveRule.cs , 19690
源码05 象棋游戏/Form1.cs , 57534
源码05 象棋游戏/Form1.resx , 103646
源码05 象棋游戏/Form2.cs , 63692
源码05 象棋游戏/Form2.resx , 49641
源码05 象棋游戏/Form3.cs , 9700
源码05 象棋游戏/Form3.resx , 34314
源码05 象棋游戏/Form4.cs , 4167
源码05 象棋游戏/Form4.resx , 5814
源码05 象棋游戏/img/blue-bing.gif , 5047
源码05 象棋游戏/img/blue-jiang.gif , 5017
源码05 象棋游戏/img/blue-ju.gif , 4996
源码05 象棋游戏/img/blue-ma.gif , 4985
源码05 象棋游戏/img/blue-pao.gif , 5244
源码05 象棋游戏/img/blue-shi.gif , 4890
源码05 象棋游戏/img/blue-xiang.gif , 5110
源码05 象棋游戏/img/BOY.GIF , 6069
源码05 象棋游戏/img/Down.gif , 1267
源码05 象棋游戏/img/GIRL.GIF , 6948
源码05 象棋游戏/img/red-ju.gif , 5165
源码05 象棋游戏/img/red-ma.gif , 5157
源码05 象棋游戏/img/red-pao.gif , 5530
源码05 象棋游戏/img/red-shi.gif , 5190
源码05 象棋游戏/img/red-shuai.gif , 5443
源码05 象棋游戏/img/red-xiang.gif , 5461
源码05 象棋游戏/img/red-zu.gif , 5240
源码05 象棋游戏/JudgeWhichOneWiner.cs , 3357
源码05 象棋游戏/KeyboardOperaterFunction.cs , 1485
源码05 象棋游戏/obj/Release/AxInterop.WMPLib.dll , 53248
源码05 象棋游戏/obj/Release/Interop.WMPLib.dll , 339968
源码05 象棋游戏/obj/Release/TempPE/Properties.Resources.Designer.cs.dll , 4096
源码05 象棋游戏/obj/Release/双人象棋游戏.exe , 233472
源码05 象棋游戏/obj/Release/双人象棋游戏.Properties.Resources.resources , 180
源码05 象棋游戏/obj/Release/智能象棋游戏.csproj.FileListAbsolute.txt , 4858
源码05 象棋游戏/obj/Release/智能象棋游戏.csproj.GenerateResource.Cache , 1021
源码05 象棋游戏/obj/Release/智能象棋游戏.csproj.ResolveComReference.cache , 634
源码05 象棋游戏/obj/Release/智能象棋游戏.Form1.resources , 65906
源码05 象棋游戏/obj/Release/智能象棋游戏.Form2.resources , 42606
源码05 象棋游戏/obj/Release/智能象棋游戏.Form3.resources , 22820
源码05 象棋游戏/obj/Release/智能象棋游戏.Form4.resources , 180
源码05 象棋游戏/PlayMusic.cs , 2677
源码05 象棋游戏/Properties/Resources.Designer.cs , 2860
源码05 象棋游戏/Properties/Resources.resx , 5817
源码05 象棋游戏/RegretMoveFlag.cs , 6780
源码05 象棋游戏/RepaintPictureToRound.cs , 1587
源码05 象棋游戏/save/SAVA.bin , 45131
源码05 象棋游戏/SaveGameStatus.cs , 11093
源码05 象棋游戏/sound/back.wav , 4222
源码05 象棋游戏/sound/bk_music/first.WAV , 294380
源码05 象棋游戏/sound/bk_music/second.WAV , 720044
源码05 象棋游戏/sound/bk_music/three.WAV , 633644
源码05 象棋游戏/sound/fall.WAV , 790
源码05 象棋游戏/sound/hold.WAV , 4856
源码05 象棋游戏/sound/huiqi.wav , 77344
源码05 象棋游戏/sound/huiqiend.WAV , 4040
源码05 象棋游戏/sound/jiangjun.WAV , 6956
源码05 象棋游戏/sound/kill.WAV , 4924
源码05 象棋游戏/sound/mayfall.wav , 48988
源码05 象棋游戏/sound/move.WAV , 11788
源码05 象棋游戏/sound/no.wav , 24530
源码05 象棋游戏/sound/popup.WAV , 3700
源码05 象棋游戏/sound/return_blue.WAV , 46414
源码05 象棋游戏/sound/return_red.WAV , 49660
源码05 象棋游戏/sound/start.wav , 67364
源码05 象棋游戏/sound/win.WAV , 89900
源码05 象棋游戏/双人象棋游戏.suo , 7680
源码05 象棋游戏/智能象棋游戏.csproj , 6526
源码05 象棋游戏/智能象棋游戏.csproj.user , 485
源码05 象棋游戏/智能象棋游戏.sln , 908
源码05 象棋游戏/智能象棋游戏.suo , 31744
源码05 象棋游戏/智能象棋游戏_TemporaryKey.pfx , 1668
源码05 象棋游戏/游戏布置文件.ini , 9059
没有账号? 忘记密码?

社交账号快速登录