📄 main.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
namespace 五子棋
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
/// 左边21,右边511,上24,下514;共14格,r=35--
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.Button ConfigIpbtn;
private System.Windows.Forms.Button JoinGamebtn;
private System.Windows.Forms.Label st;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label netinforlable;
private System.Windows.Forms.Button launchGamebtn;
/// <summary>
/// 是否轮到我
/// </summary>
private bool turn;
Bitmap oldbmp,usingbmp;Win iswin;chessgo five;
private bool exists=false;
Connect conn=new Connect();
string info,oldinfo;
private System.Windows.Forms.TextBox IPtextBox;
private System.Windows.Forms.Button Beginbtn;
private System.Windows.Forms.Button disconnectbtn;
IpConfig config=new IpConfig();
public MainForm()
{
//
// 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.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.launchGamebtn = new System.Windows.Forms.Button();
this.ConfigIpbtn = new System.Windows.Forms.Button();
this.st = new System.Windows.Forms.Label();
this.JoinGamebtn = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.netinforlable = new System.Windows.Forms.Label();
this.IPtextBox = new System.Windows.Forms.TextBox();
this.Beginbtn = new System.Windows.Forms.Button();
this.disconnectbtn = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(182)))), ((int)(((byte)(146)))));
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(546, 521);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
//
// pictureBox2
//
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.No;
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(552, 120);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(33, 33);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
//
// pictureBox3
//
this.pictureBox3.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
this.pictureBox3.Location = new System.Drawing.Point(608, 120);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(33, 33);
this.pictureBox3.TabIndex = 2;
this.pictureBox3.TabStop = false;
//
// label1
//
this.label1.Location = new System.Drawing.Point(542, 176);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 40);
this.label1.TabIndex = 3;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(182)))), ((int)(((byte)(146)))));
this.label2.Location = new System.Drawing.Point(592, 176);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 40);
this.label2.TabIndex = 4;
//
// pictureBox4
//
this.pictureBox4.Cursor = System.Windows.Forms.Cursors.No;
this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
this.pictureBox4.Location = new System.Drawing.Point(552, 488);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(33, 33);
this.pictureBox4.TabIndex = 5;
this.pictureBox4.TabStop = false;
this.pictureBox4.Visible = false;
//
// pictureBox5
//
this.pictureBox5.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image")));
this.pictureBox5.Location = new System.Drawing.Point(600, 488);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(33, 33);
this.pictureBox5.TabIndex = 6;
this.pictureBox5.TabStop = false;
this.pictureBox5.Visible = false;
//
// launchGamebtn
//
this.launchGamebtn.Location = new System.Drawing.Point(560, 354);
this.launchGamebtn.Name = "launchGamebtn";
this.launchGamebtn.Size = new System.Drawing.Size(72, 32);
this.launchGamebtn.TabIndex = 7;
this.launchGamebtn.Text = "建立游戏";
this.launchGamebtn.Click += new System.EventHandler(this.NewGamebutton_Click);
//
// ConfigIpbtn
//
this.ConfigIpbtn.Location = new System.Drawing.Point(560, 448);
this.ConfigIpbtn.Name = "ConfigIpbtn";
this.ConfigIpbtn.Size = new System.Drawing.Size(72, 32);
this.ConfigIpbtn.TabIndex = 8;
this.ConfigIpbtn.Text = "配置";
this.ConfigIpbtn.Click += new System.EventHandler(this.Configbutton_Click);
//
// st
//
this.st.Location = new System.Drawing.Point(544, 0);
this.st.Name = "st";
this.st.Size = new System.Drawing.Size(96, 88);
this.st.TabIndex = 9;
//
// JoinGamebtn
//
this.JoinGamebtn.Location = new System.Drawing.Point(560, 416);
this.JoinGamebtn.Name = "JoinGamebtn";
this.JoinGamebtn.Size = new System.Drawing.Size(72, 32);
this.JoinGamebtn.TabIndex = 10;
this.JoinGamebtn.Text = "加入游戏";
this.JoinGamebtn.Click += new System.EventHandler(this.Joinbutton_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// netinforlable
//
this.netinforlable.Location = new System.Drawing.Point(544, 224);
this.netinforlable.Name = "netinforlable";
this.netinforlable.Size = new System.Drawing.Size(96, 64);
this.netinforlable.TabIndex = 11;
this.netinforlable.Visible = false;
//
// IPtextBox
//
this.IPtextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(182)))), ((int)(((byte)(146)))));
this.IPtextBox.Location = new System.Drawing.Point(544, 392);
this.IPtextBox.Name = "IPtextBox";
this.IPtextBox.Size = new System.Drawing.Size(104, 21);
this.IPtextBox.TabIndex = 12;
//
// Beginbtn
//
this.Beginbtn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.Beginbtn.Location = new System.Drawing.Point(560, 224);
this.Beginbtn.Name = "Beginbtn";
this.Beginbtn.Size = new System.Drawing.Size(72, 32);
this.Beginbtn.TabIndex = 13;
this.Beginbtn.Text = "开始";
this.Beginbtn.Click += new System.EventHandler(this.Rebuildbutton_Click);
//
// disconnectbtn
//
this.disconnectbtn.Location = new System.Drawing.Point(560, 256);
this.disconnectbtn.Name = "disconnectbtn";
this.disconnectbtn.Size = new System.Drawing.Size(72, 32);
this.disconnectbtn.TabIndex = 14;
this.disconnectbtn.Text = "断开连接";
this.disconnectbtn.Click += new System.EventHandler(this.StopNetbutton_Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(182)))), ((int)(((byte)(146)))));
this.ClientSize = new System.Drawing.Size(648, 534);
this.Controls.Add(this.disconnectbtn);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -