📄 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 Configbutton;
private System.Windows.Forms.Button Joinbutton;
private System.Windows.Forms.Label st;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Label netinforlable;
private System.Windows.Forms.Button buildGamebutton;
/// <summary>
/// 是否轮到我
/// </summary>
private bool Myturn;
Bitmap oldbmp,usingbmp;IsWin iswin;gobang five;
private bool onebodyin=false;
NetWork network=new NetWork();
string infor,oldinfor;
private System.Windows.Forms.TextBox IPtextBox;
private System.Windows.Forms.Button Rebuildbutton;
private System.Windows.Forms.Button StopNetbutton;
Config config=new Config();
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.Resources.ResourceManager resources = new System.Resources.ResourceManager(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.buildGamebutton = new System.Windows.Forms.Button();
this.Configbutton = new System.Windows.Forms.Button();
this.st = new System.Windows.Forms.Label();
this.Joinbutton = 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.Rebuildbutton = new System.Windows.Forms.Button();
this.StopNetbutton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// pictureBox1
//
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(536, 536);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
//
// 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(536, 176);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 40);
this.label1.TabIndex = 3;
//
// label2
//
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;
//
// buildGamebutton
//
this.buildGamebutton.Location = new System.Drawing.Point(560, 352);
this.buildGamebutton.Name = "buildGamebutton";
this.buildGamebutton.Size = new System.Drawing.Size(72, 32);
this.buildGamebutton.TabIndex = 7;
this.buildGamebutton.Text = "建立游戏";
this.buildGamebutton.Click += new System.EventHandler(this.NewGamebutton_Click);
//
// Configbutton
//
this.Configbutton.Location = new System.Drawing.Point(560, 448);
this.Configbutton.Name = "Configbutton";
this.Configbutton.Size = new System.Drawing.Size(72, 32);
this.Configbutton.TabIndex = 8;
this.Configbutton.Text = "配置";
this.Configbutton.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;
//
// Joinbutton
//
this.Joinbutton.Location = new System.Drawing.Point(560, 416);
this.Joinbutton.Name = "Joinbutton";
this.Joinbutton.Size = new System.Drawing.Size(72, 32);
this.Joinbutton.TabIndex = 10;
this.Joinbutton.Text = "加入游戏";
this.Joinbutton.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(((System.Byte)(214)), ((System.Byte)(182)), ((System.Byte)(146)));
this.IPtextBox.Location = new System.Drawing.Point(536, 392);
this.IPtextBox.Name = "IPtextBox";
this.IPtextBox.Size = new System.Drawing.Size(104, 21);
this.IPtextBox.TabIndex = 12;
this.IPtextBox.Text = "202.115.22.";
//
// Rebuildbutton
//
this.Rebuildbutton.Location = new System.Drawing.Point(560, 224);
this.Rebuildbutton.Name = "Rebuildbutton";
this.Rebuildbutton.Size = new System.Drawing.Size(72, 32);
this.Rebuildbutton.TabIndex = 13;
this.Rebuildbutton.Text = "新开始";
this.Rebuildbutton.Click += new System.EventHandler(this.Rebuildbutton_Click);
//
// StopNetbutton
//
this.StopNetbutton.Location = new System.Drawing.Point(560, 256);
this.StopNetbutton.Name = "StopNetbutton";
this.StopNetbutton.Size = new System.Drawing.Size(72, 32);
this.StopNetbutton.TabIndex = 14;
this.StopNetbutton.Text = "停止网络";
this.StopNetbutton.Click += new System.EventHandler(this.StopNetbutton_Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(214)), ((System.Byte)(182)), ((System.Byte)(146)));
this.ClientSize = new System.Drawing.Size(648, 534);
this.Controls.Add(this.StopNetbutton);
this.Controls.Add(this.Rebuildbutton);
this.Controls.Add(this.IPtextBox);
this.Controls.Add(this.netinforlable);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -