资源简介

模仿windows纸牌游戏,双击就可以玩,也可移动纸牌,规则下方红黑相间,上方同色,很简单,建议玩几次试试,了解逻辑再看代码。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Collections;

namespace 纸牌
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        class card
        {
            public int index;
            public bool show_face;
            public int pile;
            public int index_of_pile;
            public Point left_up_point;
        }
        static int H = 30;
        static int W = 30;
        Point point_mousedown_on_panel_title;
        Point point_mousedown_on_panel_operate;
        Point[] point_14_pile_initial_pozition = new Point[14];//第14个点是鼠标那一摞的坐标
        ImageList imagelist;//最好不用Imagelist来存储图像,因为Imagelist有大小限制
        Bitmap bmp_draw;
        Bitmap bmp_show;
        card[] card_pack = new card[52];
        Timer timer_draw;
        Timer timer_time;
        bool is_ready_draw;
        int selected_index;
        int old_pile;
        ArrayList[] arylist_14_pile = new ArrayList[14];
        void xipai()
        {
            ArrayList arraylist = new ArrayList();
            for (int i = 0; i < 52; i++)
            {
                arraylist.Add(i);
            }
            Random rd = new Random();
            int n;
            for (int i = 0; i < 52; i++)
            {
                card_pack[i] = new card();
                n = rd.Next(0 arraylist.Count);
                card_pack[i].index = (int)arraylist[n];
                arraylist.RemoveAt(n);
            }
        }
        void fapai()
        {
            for (int i = 0; i < 52; i++)
            {
                card_pack[i].show_face = false;
            }
            for (int i = 0; i < 7; i++)
            {
                card_pack[51 - i].pile = 12;
                card_pack[51 - i].index_of_pile = i;
            }
            card_pack[45].show_face = true;
            for (int i = 0; i < 6; i++)
            {
                card_pack[44 - i].pile = 11;
                card_pack[44 - i].index_of_pile = i;
            }
            card_pack[39].show_face = true;
            for (int i = 0; i < 5; i++)
            {
                card_pack[38 - i].pile = 10;
                card_pack[38 - i].index_of_pile = i;
            }
            card_pack[34].show_face = true;
            for (int i = 0; i < 4; i++)
            {
                card_pack[33 - i].pile = 9;
                card_pack[33 - i].index_of_pile = i;
            }
            card_pack[30].show_face = true;
            for (int i = 0; i < 3; i++)
            {
                card_pack[29 - i].pile = 8;
                card_pack[29 - i].index_of_pile = i;
            }
            card_pack[27].show_face = true;
            for (int i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-15 21:57  指派游戏\
     目录           0  2018-07-04 13:39  指派游戏\CSharpSolitaire_1.0\
     文件         187  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\App.config
     文件        6731  2013-12-27 10:27  指派游戏\CSharpSolitaire_1.0\Form1.Designer.cs
     文件       40685  2013-12-27 10:27  指派游戏\CSharpSolitaire_1.0\Form1.cs
     文件        5817  2013-12-27 10:27  指派游戏\CSharpSolitaire_1.0\Form1.resx
     文件         518  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Program.cs
     目录           0  2013-12-31 09:45  指派游戏\CSharpSolitaire_1.0\Properties\
     文件        1332  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Properties\AssemblyInfo.cs
     文件        2864  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Properties\Resources.Designer.cs
     文件        5612  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Properties\Resources.resx
     文件        1093  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Properties\Settings.Designer.cs
     文件         249  2013-11-18 20:38  指派游戏\CSharpSolitaire_1.0\Properties\Settings.settings
     目录           0  2013-12-31 09:45  指派游戏\CSharpSolitaire_1.0\bin\
     目录           0  2013-12-31 09:45  指派游戏\CSharpSolitaire_1.0\bin\Debug\
     目录           0  2013-12-31 09:45  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\
     文件       18407  2013-11-17 18:13  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\back.png
     目录           0  2013-12-31 09:45  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\
     文件       94397  2013-11-17 17:50  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp10.png
     文件       94397  2013-11-17 17:45  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp2.png
     文件       94397  2013-11-17 17:46  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp3.png
     文件       94397  2013-11-17 17:47  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp4.png
     文件       94397  2013-11-17 17:47  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp5.png
     文件       94397  2013-11-17 17:48  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp6.png
     文件       94397  2013-11-17 17:48  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp7.png
     文件       94397  2013-11-17 17:49  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp8.png
     文件       96879  2013-11-17 17:50  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fp9.png
     文件       94397  2013-11-17 17:42  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fpA.png
     文件       94397  2013-11-17 17:51  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fpJ.png
     文件       94397  2013-11-17 17:51  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fpK.png
     文件       94397  2013-11-17 17:51  指派游戏\CSharpSolitaire_1.0\bin\Debug\poker\方片\fpQ.png
............此处省略147个文件信息

评论

共有 条评论