• 大小: 52KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-05-16
  • 语言: C#
  • 标签: wuziqi  

资源简介

C#五子棋 无控件 手动绘图 丰富的多年开发经验 值得一下

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;


namespace fivechess
{
    public  class chess
    {
        public int ChessColor;
        public int [] borad =new int [1717];
        private Stack historyPosition = new Stack();
        private Graphics g = null;
        public int winh;                  //黑胜标记
        public int winb;                  //白胜标记
        public int firstChess;            //先下棋标记

        public int FirstChess
        {
            get { return firstChess; }
            set { firstChess = value; }
        }

        public int Winh
        {
            get { return winh; }
            set { winh = value; }
        }

        public int Winb
        {
            get { return winb; }
            set { winb = value; }
        }

        public Graphics G
        {
            get { return g; }
            set { g = value; }
        }

        public void addChess(int si int sj)
        {
            int s1 = si;                                                       //获取棋子坐标                                           
            int i = s1 - 20;
            i = i % 30;
            int s2 = sj;
            int j = s2 - 30;
            j = j % 30;
            if (i <= 15)
            {
                si = si - i - 15;
            }
            else
                si = si - i + 15;
            if (j <= 15)
            {
                sj = sj - j - 15;
            }
            else
                sj = sj - j + 15;
            int brow = (si - 5) / 30;                                   //此两行为棋子坐标
            int bcol = (sj - 15) / 30;
            try
            {
                if ((brow >= 0 && brow <= 530) && (bcol >= 0 && bcol <= 530))
                {
                    if (ChessColor == 0)                                        //往棋盘中下棋
                    {
                        if (borad[brow bcol] == 0)
                        {
                            drawblack(si sj);
                            ChessColor = 1;
                            drawWhite(119 + 30 530);
                            //si = (si - 5) / 30;
                            //sj = (sj - 15) / 30;
                            borad[brow bcol] = 1;
                        }
                        else return;
                    }
                    else
                    {
                        if (borad[brow bcol] == 0)
                        {
                            drawWhite(si sj);
                            ChessColor = 0;
                            drawblack(119 + 30 530);
                            borad[brow bcol] = 2;
                        }
                        else return;
                    }
                }

                historyPosition.Push(new Point(brow bcol));                 //保存棋子信息
                win(brow bc

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      15872  2010-02-28 14:27  fivechess\fivechess\bin\Debug\fivechess.exe

     文件      40448  2010-02-28 14:27  fivechess\fivechess\bin\Debug\fivechess.pdb

     文件      14328  2010-06-11 10:22  fivechess\fivechess\bin\Debug\fivechess.vshost.exe

     文件        490  2009-06-11 05:14  fivechess\fivechess\bin\Debug\fivechess.vshost.exe.manifest

     文件      10895  2010-02-28 14:11  fivechess\fivechess\chess.cs

     文件       3765  2010-02-27 20:47  fivechess\fivechess\fivechess.csproj

     文件       4098  2010-02-28 14:27  fivechess\fivechess\Form1.cs

     文件       6095  2010-02-27 19:04  fivechess\fivechess\Form1.Designer.cs

     文件       6012  2010-02-27 19:04  fivechess\fivechess\Form1.resx

     文件        832  2010-06-11 10:22  fivechess\fivechess\obj\Debug\fivechess.csproj.FileListAbsolute.txt

     文件        847  2010-02-27 19:04  fivechess\fivechess\obj\Debug\fivechess.csproj.GenerateResource.Cache

     文件      15872  2010-02-28 14:27  fivechess\fivechess\obj\Debug\fivechess.exe

     文件        180  2010-02-27 20:47  fivechess\fivechess\obj\Debug\fivechess.Form1.resources

     文件      40448  2010-02-28 14:27  fivechess\fivechess\obj\Debug\fivechess.pdb

     文件        180  2010-02-27 20:47  fivechess\fivechess\obj\Debug\fivechess.Properties.Resources.resources

     文件        490  2010-02-26 08:48  fivechess\fivechess\Program.cs

     文件       1350  2010-02-26 08:48  fivechess\fivechess\Properties\AssemblyInfo.cs

     文件       2868  2010-02-26 08:48  fivechess\fivechess\Properties\Resources.Designer.cs

     文件       5612  2010-02-26 08:48  fivechess\fivechess\Properties\Resources.resx

     文件       1094  2010-02-26 08:48  fivechess\fivechess\Properties\Settings.Designer.cs

     文件        249  2010-02-26 08:48  fivechess\fivechess\Properties\Settings.settings

     文件        917  2010-02-26 08:48  fivechess\fivechess.sln

    ..A..H.     18432  2010-06-11 10:25  fivechess\fivechess.suo

     目录          0  2010-02-26 09:39  fivechess\fivechess\obj\Debug\Refactor

     目录          0  2010-02-26 08:48  fivechess\fivechess\obj\Debug\TempPE

     目录          0  2010-02-26 09:03  fivechess\fivechess\bin\Debug

     目录          0  2010-02-28 14:27  fivechess\fivechess\obj\Debug

     目录          0  2010-02-26 08:48  fivechess\fivechess\bin

     目录          0  2010-02-26 08:48  fivechess\fivechess\obj

     目录          0  2010-02-26 08:48  fivechess\fivechess\Properties

............此处省略5个文件信息

评论

共有 条评论

相关资源