资源简介
基于winfrom的联网双人对战五子棋,双人对战,用到socket通讯技术
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Net;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.groupBox1.MouseClick += new MouseEventHandler(this.groupbox_Click);
}
bool isput;//是否落子
TcpClient tcpClient;
PictureBox[] chesspb = new PictureBox[15 15];//定义棋子数组
//棋子
public class qizi
{
public int color;
}
qizi[] qizis = new qizi[15 15];//棋子数组
int blackWinInt = 0;//黑子胜场
int whiteWinInt = 0;//白子胜场
private void Form1_Load(object sender EventArgs e)
{
string hostName = Dns.GetHostName(); //获取本机名
IPHostEntry localhost = Dns.GetHostByName(hostName); //方法已过期,可以获取IPv4的地址
//IPHostEntry localhost = Dns.GetHostEntry(hostName); //获取IPv6地址
IPAddress localaddr = localhost.AddressList[0];
IP.Text = localaddr.ToString();
//画棋子
int x y;
for (x = 0; x < 15; x++)
{
for (y = 0; y < 15; y++)
{
chesspb[x y] = new PictureBox();
chesspb[x y].Location = new Point(45 + 30 * x 45 + 30 * y);//这是棋子图的左上角坐标
chesspb[x y].Size = new Size(10 10);///棋子图尺寸
chesspb[x y].BackColor = Color.Wheat;
chesspb[x y].SizeMode = PictureBoxSizeMode.CenterImage;
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(chesspb[x y].ClientRectangle);
Region region = new Region(gp);
chesspb[x y].Region = region;
chesspb[x y].Visible = false;//先隐藏棋子
groupBox1.Controls.Add(chesspb[x y]);
}
}
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 15; j++)
{
qizi qz = new qizi();
qz.color = 0;
qizis[i j] = qz;
}
}
}
//画棋盘
private void groupBox1_Paint(object sender PaintEventArgs e)
{
//画格子
int i;
Graphics gr = e.Graphics;
Pen myPen = new Pen(Color.Black 1);
Pen margin = new Pen(Color.Black 2);
//这里是在给棋盘加一个框框哦~
gr.DrawLine(margin 30 30 30 490);
gr.DrawLine(margin 30 30 490 30);
gr.DrawLine(margin 30 490 490 490);
gr.DrawLine(margin 490 30 490 490);
for
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 130 2018-12-28 14:04 WindowsFormsApplication1 - client\WindowsFormsApplication1\app.config
文件 127 2018-12-22 15:19 WindowsFormsApplication1 - client\WindowsFormsApplication1\bai.png
文件 15872 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 130 2018-12-28 14:04 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 32256 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 11608 2019-02-20 13:10 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 130 2018-12-28 14:04 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2010-03-17 22:39 WindowsFormsApplication1 - client\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 9047 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\Form1.cs
文件 6461 2018-12-28 13:03 WindowsFormsApplication1 - client\WindowsFormsApplication1\Form1.Designer.cs
文件 6011 2018-12-28 13:03 WindowsFormsApplication1 - client\WindowsFormsApplication1\Form1.resx
文件 18211 2018-12-22 15:17 WindowsFormsApplication1 - client\WindowsFormsApplication1\hei.png
文件 6170 2018-12-28 13:42 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6565 2019-02-20 13:10 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2018-12-28 13:43 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2018-12-28 13:43 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2018-12-28 13:43 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 4608 2018-12-28 14:06 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 1749 2019-02-20 13:10 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 975 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
文件 15872 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.exe
文件 180 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form1.resources
文件 32256 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.pdb
文件 180 2019-02-20 13:09 WindowsFormsApplication1 - client\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Properties.Resources.resources
文件 485 2018-12-28 13:43 WindowsFormsApplication1 - client\WindowsFormsApplication1\Program.cs
文件 1400 2018-12-22 15:05 WindowsFormsApplication1 - client\WindowsFormsApplication1\Properties\AssemblyInfo.cs
文件 2888 2018-12-28 14:04 WindowsFormsApplication1 - client\WindowsFormsApplication1\Properties\Resources.Designer.cs
文件 5612 2018-12-22 15:05 WindowsFormsApplication1 - client\WindowsFormsApplication1\Properties\Resources.resx
文件 1124 2018-12-28 14:04 WindowsFormsApplication1 - client\WindowsFormsApplication1\Properties\Settings.Designer.cs
文件 249 2018-12-22 15:05 WindowsFormsApplication1 - client\WindowsFormsApplication1\Properties\Settings.settings
............此处省略58个文件信息
相关资源
- c#注册表监控
- 电脑挂机锁C#
- 计算器C#工厂模式实现代码
- 漂亮的winform日历控件类似outlook
- winform窗体中嵌入网页与JS交互
- 一个用C#编写的简单记账系统
- 最新版CodeMaid_v11.rar
- c# UDP 局域网异步通讯实现广播,接收
- c# winform webbrowser页面中js调用winform类
- C#UDP实现停等协议
- c# winform 向导 Wizard
- C#内存修改器源码2012918
- [C# ]史上最强动画屏保-包含138套动画
- C#开发的游戏服务器demoC/S案例,可运
- 百度翻译APIC#
- 自动从NTP服务器同步本地时间WinForm
- C#写的放大镜程序模拟真实放大镜的效
- c#实现D8单流向算法
- RunJoyStickOnLocalMachine.zip
- 基于asp.net c#在线答题页面
- HTTPS证书创建+绑定端口+C#程序监听
- 实现UDP可靠文件传输
- VB.NET C# 截屏小工具
- C# GDI+ Demo.zip
- C#写的控制台NTP服务端以及winform的N
- C# 备份还原sqlserver,SQL server还原,附
- C#的串口助手源码例程
- 立体像对的空间前方交会-点投影系数
- C#交会法测量程序.zip
- 住院收费管理系统,。数据库课程设
评论
共有 条评论