資源簡介
這是基于MFC 寫的windows 附帶紙牌

代碼片段和文件信息
//?ChildView.cpp?:?CChildView?類的實現
//
#include?“stdafx.h“
#include?“sol.h“
#include?“ChildView.h“
#include?
#define?TOP_TOP?4
#define?BOTTOM_TOP?107
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#endif
//?CChildView
CChildView::CChildView()
:?m_nPkCount(0)
?m_isGameOver(false)
{
}
CChildView::~CChildView()
{
}
BEGIN_MESSAGE_MAP(CChildView?CWnd)
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_RBUTTONUP()
ON_COMMAND(ID_POKERFLOP?&CChildView::OnPokerflop)
ON_MESSAGE(WM_PK_LBPRESS?OnPokerLBPress)
ON_WM_ERASEBKGND()
ON_WM_TIMER()
ON_COMMAND(ID_AC_ESC?&CChildView::OnAcEsc)
END_MESSAGE_MAP()
//?CChildView?消息處理程序
//狀態欄計秒
extern?UINT?ncTime;
//鍵盤鉤子
HHOOK?g_hMouse?=?NULL;
CWnd*?pWnd?=?NULL;
LRESULT?CALLBACK?MouseProc(int?nCode?WPARAM?wParam?LPARAM?lParam)
{
if?(wParam?>=WM_LBUTTONDOWN??&&?wParam?<=?WM_MBUTTONDBLCLK)?{
dynamic_cast(pWnd)->GameOver();
return?true;
}
return?CallNextHookEx(g_hMouse??nCode?wParam?lParam);
}
//
BOOL?CChildView::PreCreateWindow(CREATESTRUCT&?cs)?
{
if?(!CWnd::PreCreateWindow(cs))
return?FALSE;
cs.lpszClass?=?AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS?
::LoadCursor(NULL?IDC_ARROW)?CreateSolidBrush(RGB(0?128?0))?NULL);
return?TRUE;
}
//
int?CChildView::OnCreate(LPCREATESTRUCT?lpCreateStruct)
{
if?(CWnd::OnCreate(lpCreateStruct)?==?-1)
return?-1;
//?TODO:??在此添加您專用的創建代碼
//--------創建-------紙牌
m_aPoker[0].Create(this?0?11?TOP_TOP?56?53);
m_aPoker[0].m_iGroup?=?0;
for?(int?j?=?1;?j?<=?52;?j++)?{
m_aPoker[j].Create(thisj?-71?-96?j?55);
}
//------初化放牌位置top---
for(int?i?=?2;?i?9;?i++)?{
m_aPos[i].SetTop(BOTTOM_TOP);
}
m_aPos[0].SetTop(TOP_TOP);
m_aPos[1].SetTop(TOP_TOP);
for?(int?i?=?9;?i?13;?i++)?{
m_aPos[i].SetTop(TOP_TOP);
m_acsTop[i-9].Create(NULL?WS_CHILD|?WS_VISIBLE?|?SS_BITMAP?|?WS_CLIPSIBLINGSm_aPos[i].rect?this);
m_acsTop[i-9].SetBitmap(::LoadBitmap(::AfxGetInstanceHandle()?MAKEINTRESOURCE(57)));
}
InitialPoker();
return?0;
}
//
BOOL?CChildView::PreTranslateMessage(MSG*?pMsg)
{
//?TODO:?在此添加專用代碼和/或調用基類
switch(pMsg->message)
{
case?WM_LBUTTONDBLCLK:
return?!PokerLDClk(::GetDlgCtrlID(pMsg->hwnd));
break;
//這里處理問題多多
//case?WM_LBUTTONDOWN:
//
// break;
//case?WM_LBUTTONUP:
//
// break;
case?WM_RBUTTONUP:
SendMessage(WM_RBUTTONUP);
return?true;
break;
}
return?CWnd::PreTranslateMessage(pMsg);
}
//?根據窗口的寬設置放牌的位置
void?CChildView::SetPosLeft(int?nWidth)
{
if?(nWidth?585?||?m_isGameOver)?{
return;
}
int?interval?=?(nWidth?-?PK_WIDTH?*?7)?/?8;
for(int?i?=?2;?i?9;?i++)?{
m_aPos[i].SetLeft((i?-?1)?*?interval?+?(i?-?2)?*?PK_WIDTH);
}
m_aPos[0].SetLeft(interval);
m_aPos[1].SetLeft(interval?*?2?+?PK_WIDTH);
for?(int?i?=?9;?i?13;?i++)?{
m_aPos[i].SetLeft((i?-?5)?*?interval?+?(i?-?6)?*?PK_WIDTH);
m_acsTop[i-9].MoveWindow(m_aPos[i].GetLef
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-11-22?19:55??sol\
?????目錄???????????0??2010-11-22?14:50??sol\debug\
?????目錄???????????0??2010-11-22?19:53??sol\release\
?????文件??????401408??2010-11-22?19:52??sol\release\sol.exe
?????目錄???????????0??2010-11-22?19:53??sol\sol\
?????文件???????15623??2010-11-22?19:52??sol\sol\ChildView.cpp
?????文件????????1566??2010-11-22?18:24??sol\sol\ChildView.h
?????目錄???????????0??2010-11-22?14:51??sol\sol\Debug\
?????文件????????2883??2010-11-22?14:47??sol\sol\MainFrm.cpp
?????文件?????????850??2010-11-22?14:48??sol\sol\MainFrm.h
?????文件????????2989??2010-11-22?14:27??sol\sol\Poker.cpp
?????文件????????1104??2010-11-22?14:43??sol\sol\Poker.h
?????文件?????????425??2010-11-16?11:36??sol\sol\Pos.cpp
?????文件?????????326??2010-11-15?21:30??sol\sol\Pos.h
?????文件????????2252??2010-11-14?22:13??sol\sol\ReadMe.txt
?????目錄???????????0??2010-11-22?19:53??sol\sol\Release\
?????目錄???????????0??2010-11-14?22:59??sol\sol\res\
?????目錄???????????0??2010-11-22?19:51??sol\sol\res\pic\
?????文件????????3574??2010-11-15?13:22??sol\sol\res\pic\1.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\10.bmp
?????文件????????3574??2010-11-15?13:22??sol\sol\res\pic\11.bmp
?????文件????????3574??2010-11-15?13:22??sol\sol\res\pic\12.bmp
?????文件????????3574??2010-11-15?13:22??sol\sol\res\pic\13.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\14.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\15.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\16.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\17.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\18.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\19.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\2.bmp
?????文件????????1214??2010-11-15?13:22??sol\sol\res\pic\20.bmp
............此處省略58個文件信息
- 上一篇:rsa簽名 C語言實現
- 下一篇:羅德里格斯變換-scilab代碼
評論
共有 條評論