資源簡介
拱豬撲克牌游戲(C#源碼)

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Windows.Forms;
using?System.Drawing;
namespace?mycards
{
????public?class?Card?:?PictureBox
????{
????????//?Suit指的是花色,1為梅花,2為方鉆,3為紅心,4為黑桃?
????????private?byte?suit;???????????????//花色
????????private?byte?faceNum;????????????//?FaceNum?指的是牌面1--13數字(點數)
????????private?byte?power;??????????????//?Power指的是牌的實際大小
????????private?Image?cardImage?=?null;??//牌的正面圖
????????private?Image?cardBackImage?=?null;?//牌的背面圖
????????public?Card(byte?Suit?byte?FaceNum)
????????{
????????????this.faceNum?=?FaceNum;
????????????this.suit?=?Suit;
????????????//設置實際大小,牌A比牌K大
????????????if?(FaceNum?==?1)?power?=?14;
????????????else?power?=?FaceNum;
????????}
????????public?Card()
????????{
????????}
????????public?byte?Suit??????????//花色屬性
????????{
????????????get
????????????{
????????????????return?suit;
????????????}
????????}
????????public?byte?Power???????//點數屬性
????????{
????????????get
????????????{
????????????????return?power;
????????????}
????????}
????????public?byte?FaceNum???????//牌的實際大小屬性
????????{
????????????get
????????????{
????????????????return?faceNum;
????????????}
????????}
????????public?int?pic_order()????//計算牌的圖像索引號
????????{
????????????return?(Suit?-?1)?*?13?+?FaceNum;
????????}
????????public?void?show()
????????{
????????????string?imageName?=“_“+pic_order().ToString();
????????????cardImage?=?(Image)Properties.Resources.ResourceManager.Getobject(imageName);
????????????//string?filename?=?Application.StartupPath+“\\..\\..\\bmp\\“?+?n.ToString()?+?“.bmp“;
????????????//cardImage=?Image.FromFile(filename);
????????????if?(cardImage?!=?null)
????????????????this.Image?=?cardImage;
????????}
????????public?void?showBack()
????????{
????????????string?imageName?=?“_0“;
????????????cardBackImage?=?(Image)Properties.Resources.ResourceManager.Getobject(imageName);
????????????if?(cardBackImage?!=?null)
????????????????this.Image?=?cardBackImage;
????????}
????????public?void?dian(int?n)?????//計算點數和花色
????????{
????????????this.faceNum?=?(byte)(n?%?13);
????????????this.suit?=?(byte)(n?/?13?+?1);
????????}
????????public?void?SetPosition(int?left?int?top)//牌的位置
????????{
????????????this.Left?=?left;
????????????this.Top?=?top;
????????}
????????public?void?SetSize(int?w?int?h)//牌的大小
????????{
????????????this.Width?=?w;?this.Height?=?h;
????????}
????????public?void?MoveTo(int?dx?int?dy)//動畫效果
????????{
????????????int?x1?=?this.Left;
????????????int?y1?=?this.Top;
????????????for?(int?i?=?0;?i?10;?i++)
????????????{
????????????????SetPosition(x1?+?(dx?-?x1)?/?10?y1?+?(dy?-?y1)?/?10);???????????????????????????????
????????????}
????????????SetPosition(dxdy);
????????????this.BringToFront();
????????????//System.Threading.Thread.Sleep(30);???//延時0.03秒?
????????}
????????public?override?string?ToString()//重載ToString()方法
????????{
????????????string?Su
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????490??2007-07-21?09:33??拱豬撲克牌游戲\bin\Debug\mycards.vshost.exe.manifest
?????文件??????20792??2007-10-18?17:54??拱豬撲克牌游戲\bmp\0.bmp
?????文件???????1184??2007-10-18?17:47??拱豬撲克牌游戲\bmp\1.bmp
?????文件???????1184??2007-10-18?17:49??拱豬撲克牌游戲\bmp\10.bmp
?????文件???????3550??2007-10-18?17:49??拱豬撲克牌游戲\bmp\11.bmp
?????文件???????3550??2007-10-18?17:49??拱豬撲克牌游戲\bmp\12.bmp
?????文件???????3550??2007-10-18?17:49??拱豬撲克牌游戲\bmp\13.bmp
?????文件???????1214??2007-10-18?17:49??拱豬撲克牌游戲\bmp\14.bmp
?????文件???????1214??2007-10-18?17:49??拱豬撲克牌游戲\bmp\15.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\16.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\17.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\18.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\19.bmp
?????文件???????1184??2007-10-18?17:47??拱豬撲克牌游戲\bmp\2.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\20.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\21.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\22.bmp
?????文件???????1214??2007-10-18?17:50??拱豬撲克牌游戲\bmp\23.bmp
?????文件???????3550??2007-10-18?17:50??拱豬撲克牌游戲\bmp\24.bmp
?????文件???????3550??2007-10-18?17:51??拱豬撲克牌游戲\bmp\25.bmp
?????文件???????3550??2007-10-18?17:51??拱豬撲克牌游戲\bmp\26.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\27.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\28.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\29.bmp
?????文件???????1184??2007-10-18?17:48??拱豬撲克牌游戲\bmp\3.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\30.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\31.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\32.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\33.bmp
?????文件???????1214??2007-10-18?17:51??拱豬撲克牌游戲\bmp\34.bmp
............此處省略60個文件信息
評論
共有 條評論