資源簡介
該資源是學(xué)生對MFC、C++和數(shù)據(jù)結(jié)構(gòu)的實踐,需求為實現(xiàn)畫矩形和畫直線,然后實現(xiàn)裁剪、顏色選取、清空功能。
程序添加了注釋,看起來層次非常清晰。

代碼片段和文件信息
//?DrawRectangle.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“DrawRectangle.h“
#include?“MainFrm.h“
#include?“DrawRectangleDoc.h“
#include?“DrawRectangleView.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CDrawRectangleApp
BEGIN_MESSAGE_MAP(CDrawRectangleApp?CWinApp)
//{{AFX_MSG_MAP(CDrawRectangleApp)
ON_COMMAND(ID_APP_ABOUT?OnAppAbout)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG_MAP
//?Standard?file?based?document?commands
ON_COMMAND(ID_FILE_NEW?CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN?CWinApp::OnFileOpen)
//?Standard?print?setup?command
ON_COMMAND(ID_FILE_PRINT_SETUP?CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CDrawRectangleApp?construction
CDrawRectangleApp::CDrawRectangleApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CDrawRectangleApp?object
CDrawRectangleApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CDrawRectangleApp?initialization
BOOL?CDrawRectangleApp::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
//?Change?the?registry?key?under?which?our?settings?are?stored.
//?TODO:?You?should?modify?this?string?to?be?something?appropriate
//?such?as?the?name?of?your?company?or?organization.
SetRegistryKey(_T(“Local?AppWizard-Generated?Applications“));
LoadStdProfileSettings();??//?Load?standard?INI?file?options?(including?MRU)
//?Register?the?application‘s?document?templates.??Document?templates
//??serve?as?the?connection?between?documents?frame?windows?and?views.
CSingleDocTemplate*?pDocTemplate;
pDocTemplate?=?new?CSingleDocTemplate(
IDR_MAINframe
RUNTIME_CLASS(CDrawRectangleDoc)
RUNTIME_CLASS(CMainframe)???????//?main?SDI?frame?window
RUNTIME_CLASS(CDrawRectangleView));
AddDocTemplate(pDocTemplate);
//?Parse?command?line?for?standard?shell?commands?DDE?file?open
CCommandLineInfo?cmdInfo;
ParseCommandLine(cmdInfo);
//?Dispatch?commands?specified?on?the?command?line
if?(!ProcessShellCommand(cmdInfo))
return?FALSE;
//?The?one?and?only?window?has?been?initial
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????44696??2011-04-27?10:59??DrawLine\DrawRectangle.aps
?????文件???????2530??2011-04-28?09:21??DrawLine\DrawRectangle.clw
?????文件???????4335??2011-04-26?17:41??DrawLine\DrawRectangle.cpp
?????文件???????4758??2011-04-28?09:18??DrawLine\DrawRectangle.dsp
?????文件????????534??2011-04-26?17:41??DrawLine\DrawRectangle.dsw
?????文件???????1433??2011-04-26?17:41??DrawLine\DrawRectangle.h
?????文件??????74752??2011-04-28?09:21??DrawLine\DrawRectangle.ncb
?????文件??????50688??2011-04-28?09:21??DrawLine\DrawRectangle.opt
?????文件???????1220??2011-04-28?09:20??DrawLine\DrawRectangle.plg
?????文件??????12205??2011-04-27?10:59??DrawLine\DrawRectangle.rc
?????文件???????1882??2011-04-26?17:41??DrawLine\DrawRectangleDoc.cpp
?????文件???????1552??2011-04-26?17:41??DrawLine\DrawRectangleDoc.h
?????文件??????11230??2011-04-28?09:20??DrawLine\DrawRectangleView.cpp
?????文件???????2796??2011-04-28?09:16??DrawLine\DrawRectangleView.h
?????文件????????103??2011-04-28?07:39??DrawLine\Line.h
?????文件???????2514??2011-04-26?17:41??DrawLine\MainFrm.cpp
?????文件???????1581??2011-04-26?17:41??DrawLine\MainFrm.h
?????文件???????4479??2011-04-26?17:41??DrawLine\ReadMe.txt
?????文件???????1078??2011-04-26?17:41??DrawLine\res\DrawRectangle.ico
?????文件????????405??2011-04-26?17:41??DrawLine\res\DrawRectangle.rc2
?????文件???????1078??2011-04-26?17:41??DrawLine\res\DrawRectangleDoc.ico
?????文件???????1078??2011-04-27?10:52??DrawLine\res\Toolbar.bmp
?????文件????????835??2011-04-27?10:59??DrawLine\resource.h
?????文件????????215??2011-04-26?17:41??DrawLine\StdAfx.cpp
?????文件???????1054??2011-04-26?17:41??DrawLine\StdAfx.h
?????目錄??????????0??2011-04-27?10:52??DrawLine\res
?????目錄??????????0??2011-04-28?09:21??DrawLine
?????文件?????119477??2011-04-26?17:33??實驗三.pdf
-----------?---------??----------?-----??----
???????????????348508????????????????????28
............此處省略1個文件信息
評論
共有 條評論