資源簡介
用MFC制作的仿WIN7平臺下的掃雷游戲。
游戲功能基本完善。 但一些文件操作什么的,暫時沒做了。
大家還是可以參考一下其中的icon,wave資源的使用的。

代碼片段和文件信息
//?ColorStatic.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“minesweeper.h“
#include?“ColorStatic.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CColorStatic
/////////////////////////////////////////////////////////////////////////////?
//???CColorStatic?
CColorStatic::CColorStatic()?
{?
m_TextColor???=???RGB(255255255);?
m_BackColor???=???RGB(100100100);?
}?
CColorStatic::~CColorStatic()?
{?
}?
BEGIN_MESSAGE_MAP(CColorStatic???CStatic)?
//{{AFX_MSG_MAP(CColorStatic)?
ON_WM_PAINT()?
//}}AFX_MSG_MAP
END_MESSAGE_MAP()?
/////////////////////////////////////////////////////////////////////////////?
//???CColorStatic???message???handlers?
void???CColorStatic::OnPaint()???
{?
CPaintDC???dc(this);???//???device???context???for???painting?
CRect???rect;?
GetClientRect(&rect);?
dc.SetBkMode(TRANSPARENT); ?//設(shè)置背景為透明的?
CBrush???*pBrush???=???new???CBrush(m_BackColor);?
dc.Selectobject(pBrush);?
dc.FillRect(&rectpBrush);?
CFont?font;
font.CreateFont(
22????????????????????????//?nHeight
8?????????????????????????//?nWidth
0?????????????????????????//?nEscapement
0?????????????????????????//?nOrientation
FW_NORMAL?????????????????//?nWeight
FALSE?????????????????????//?bItalic
FALSE?????????????????????//?bUnderline
0?????????????????????????//?cStrikeOut
ANSI_CHARSET??????????????//?nCharSet
OUT_DEFAULT_PRECIS????????//?nOutPrecision
CLIP_DEFAULT_PRECIS???????//?nClipPrecision
DEFAULT_QUALITY???????????//?nQuality
DEFAULT_PITCH?|?FF_SWISS??//?nPitchAndFamily
?_T(“Arial?Black“));????
CFont???*pOldFont;?
pOldFont=(CFont*)dc.Selectobject(&font);?
dc.SetTextColor(m_TextColor);?
CString???strCaption;?
//this->?GetWindowText(strCaption); ?//獲取窗口文本?
strCaption=m_WindowsText;
dc.DrawText(strCaption&rectDT_VCENTER|DT_CENTER|DT_SINGLELINE);?
dc.Selectobject(pOldFont);?
delete?pBrush;
pBrush=NULL;
}?
void???CColorStatic::SetTextColor(COLORREF???TextColor)?
{?
m_TextColor=TextColor;?
}?
void???CColorStatic::SetBkColor(COLORREF???color???=???RGB(150150150))?
{?
CRect???rect;?
GetClientRect(&rect);?
m_BackColor???=???color;?
InvalidateRect(&rect);?
}?
//DEL?void?CColorStatic::onactivate(UINT?nState?CWnd*?pWndOther?BOOL?bMinimized)?
//DEL?{
//DEL? CStatic::onactivate(nState?pWndOther?bMinimized);
//DEL?
//DEL? //?TODO:?Add?your?message?handler?code?here
//DEL?
//DEL?}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2666??2011-03-15?22:17??源代碼\ColorStatic.cpp
?????文件???????1320??2011-03-15?21:08??源代碼\ColorStatic.h
?????文件??????21433??2011-03-18?22:45??源代碼\Debug\ColorStatic.obj
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\ColorStatic.sbr
?????文件??????20349??2011-03-18?22:45??源代碼\Debug\LostDlg.obj
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\LostDlg.sbr
?????文件????4113408??2011-03-18?23:27??源代碼\Debug\MineSweeper.bsc
?????文件?????370620??2011-03-18?23:27??源代碼\Debug\MineSweeper.ilk
?????文件??????37713??2011-03-18?22:45??源代碼\Debug\MineSweeper.obj
?????文件????6886948??2011-03-18?22:45??源代碼\Debug\MineSweeper.pch
?????文件?????541696??2011-03-18?23:27??源代碼\Debug\MineSweeper.pdb
?????文件?????500528??2011-03-18?23:27??源代碼\Debug\MineSweeper.res
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\MineSweeper.sbr
?????文件?????172837??2011-03-18?22:45??源代碼\Debug\MineSweeperDlg.obj
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\MineSweeperDlg.sbr
?????文件??????35237??2011-03-18?23:27??源代碼\Debug\mybutton.obj
?????文件??????????0??2011-03-18?23:27??源代碼\Debug\mybutton.sbr
?????文件??????25044??2011-03-18?22:45??源代碼\Debug\MyStatic.obj
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\MyStatic.sbr
?????文件??????24616??2011-03-18?22:45??源代碼\Debug\OptionDlg.obj
?????文件??????????0??2011-03-18?22:45??源代碼\Debug\OptionDlg.sbr
?????文件?????105737??2011-03-18?22:45??源代碼\Debug\StdAfx.obj
?????文件????1376573??2011-03-18?22:45??源代碼\Debug\StdAfx.sbr
?????文件?????254976??2011-03-18?23:27??源代碼\Debug\vc60.idb
?????文件?????430080??2011-03-18?23:27??源代碼\Debug\vc60.pdb
?????文件???????2523??2011-03-18?22:39??源代碼\LostDlg.cpp
?????文件???????1307??2011-03-18?22:39??源代碼\LostDlg.h
?????文件?????541812??2011-03-18?22:51??源代碼\MineSweeper.aps
?????文件???????3936??2011-03-18?23:28??源代碼\MineSweeper.clw
?????文件???????1983??2011-03-17?00:34??源代碼\MineSweeper.cpp
............此處省略70個文件信息
- 上一篇:mfc界面及示波器程序源碼
- 下一篇:C++面向?qū)ο蟪绦蛟O(shè)計實驗
評論
共有 條評論