一聚教程网:一个值得你收藏的教程网站

热门教程

去年用c#写的五子棋程序

时间:2022-07-02 11:35:00 编辑:袖梨 来源:一聚教程网

c#写的五子棋程序,供学习WinForms的鼠标事件和使用GDI+
前几天没事(是去年的事了),写了一个小程序,可以用于学习C#。
程序使用了VS.NET环境编译,你的机器只要安装了.NET Framework SDK就可以运行。
源码和执行文件可以下载
http://www.wh-adv.com/download/five.zip
你不想下载也可读一下源码(图片资源等需要下载)。
namespace Leimom.FiveChess
{
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.WinForms;
using System.Data;
///
/// Summary description for Form1.
///

public class FiveForm : System.WinForms.Form
{
///
/// Required designer variable.
///

private System.ComponentModel.Container components;
private System.WinForms.ImageList imageListbw;
//define the hot Rectangle
private Rectangle[] pointSquares;
//chess information
private int[] chessTable;
private int nextTurn;
private const int bTurn = 1;
private const int wTurn = 2;
private Stack chessIndex;
public FiveForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
chessIndex = new Stack();
nextTurn = bTurn;
chessTable = new int[225];
pointSquares = new Rectangle[225];
Size size = new Size(18,18);
int x = 0;
int y = 0;
for(int i = 0;i < 225;i++)
{
x = i%15;
y = i/15;

热门栏目