Sheng Na 02.docx
《Sheng Na 02.docx》由会员分享,可在线阅读,更多相关《Sheng Na 02.docx(15页珍藏版)》请在冰豆网上搜索。
ShengNa02
课程设计(论文)任务书
SoftwareSchool College SoftwareEngineer Major 2007-2 Class
一、CourseDesign(Paper)Title DrawingBroad
二、CourseDesign(Paper)Startform3rdJan2011to7thJan2011
三、CourseDesign(Paper)Address:
CreativeBuilding,TrainingCenterofSoftwareSchool
四、CourseDesign(Paper)Specifications:
1.TheAimoftheCourseDesign
1)TomakethestudentsknowtheVCdevelopmentapplication.
2)Trainingthestudentstoknowthebasicmethodsandideasofprogramdesign.
3)Tomakethestudentanalyzeandsolveproblems.
2.TheRequirementsoftheCourseDesign
1)BasicRequirements:
1、Finishtheprojectindepently,butcanalsoaskothersforhelp.
2、Makeiteasyforusers.
3、Putforwardthedesignschemeofthesystem
4、Thesystemmustbedebugged.
5、Summarizingtheexperienceofcurriculumdesign,summarizethedesignexperience
anddesigntechniques.
2)OtherRequirements:
1、Afterwefinishedthebasicrequirement,thentheinnovativerequirementsshouldbe
designed.
3)TheRequirementsofthePaper
(1)Thepapershouldincludes:
sourcecodesystemstudyscreenshot
(2)Writeandprintthepaperaccordingtotheformat.
4)AssessmentDetails:
(1)Analysis:
20marks;
(2)Design&Development:
50marks;
(3)Test:
10marks;
(4)OralExamination:
20marks。
5)References:
[1]"TeachYourselfVisualC++6in21Days"bySams.
[2]"C++Study"byTanHaoqiang.
[3]"VC++MFCExtensionsbyExample"byJohnE.Swanke.
[4]"IntroductiontoMFCProgrammingwithVisualC++"byJohnE.Swanke
6)TheDailySchedule
TasksDays Address
ResearchandAnalysis1 Library
DesignandTest2.5 Lab
WritePaper1.5 Library、Lab
StudentSignature:
7thJan2011
课程设计(论文)评审意见
(1)Analysis(20marks):
Excellent(),Good(),Satisfactory(),Unsatisfactory(),Poor();
(2)Design&Development(20marks):
Excellent(),Good(),Satisfactory(),Unsatisfactory(),Poor();
(3)Test (20marks):
Excellent(),Good(),Satisfactory(),Unsatisfactory(),Poor();
(4)Translation (20marks):
Excellent(),Good(),Satisfactory(),Unsatisfactory(),Poor();
(5)OralExamination (20marks):
Excellent(),Good(),Satisfactory(),Unsatisfactory(),Poor();
(6)Whetherreducetoalowerrankbecauseoftheattendanceorpaper’sformat:
Yes(),No()
TeacherSignature:
thJan2011
Content
Content3
SystemStudy4
Screenshot5
SourceCode9
References15
SystemStudy
The“drawingboard”isasimpleprojectinVC++.
AppWizardhascreatedthisLesson4_Drawapplicationforyou.ThisapplicationnotonlydemonstratesthebasicsofusingtheMicrosoftFoundationclassesbutisalsoastartingpointforwritingyourapplication.
Whenyoustarttheprogram,youwillseeadrawingboard.InthetopoftheInterface,youwillseefourdrop-downboxes.Eachdrop-downboxhasdifferentdrop-downmenu.Youcandrawpictureswhateveryouwanttodraw.Whenyouclickonthemenuofnew,youcancreateanewpicture.Whenyoufinishedit.Ifyouwanttosaveit,youcanclickonthemenuofsave.Ofcourse,youcansaveeverywhere.Whenyouwanttoopenapicture,youcanclickonthemenuofopen,then,youcanopenitwhichyouwanttoopen.Whenyouwanttoprintyourpicture,youcanclickprint.Thesamethingswillappearwhenyouclickotherbuttons.
Screenshot
1.Themaininterfaceofthe“drawingboard”
2.Clickedthe“Menu”
3.Clickedthe“Edit”
4.Clickedthe“View”
5.Clickedthe“Help”
5.Clickedthe“AboutLesson4_Draw(A)…”
6.Youcandrawapicture.
SourceCode
MainFrm.cpp
#include"Lesson4_Draw.h"
#include"MainFrm.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
IMPLEMENT_DYNCREATE(CMainFrame,CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame,CFrameWnd)
END_MESSAGE_MAP()
staticUINTindicators[]=
{
ID_SEPARATOR,//statuslineindicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
CMainFrame:
:
CMainFrame(){}
CMainFrame:
:
~CMainFrame(){}
intCMainFrame:
:
OnCreate(LPCREATESTRUCTlpCreateStruct)
{
if(CFrameWnd:
:
OnCreate(lpCreateStruct)==-1)
return-1;
if(!
m_wndToolBar.CreateEx(this,TBSTYLE_FLAT,WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC)||!
m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failedtocreatetoolbar\n");
return-1;//failtocreate
}
if(!
m_wndStatusBar.Create(this)||
!
m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failedtocreatestatusbar\n");
return-1;//failtocreate
}
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return0;
}
BOOLCMainFrame:
:
PreCreateWindow(CREATESTRUCT&cs)
{
if(!
CFrameWnd:
:
PreCreateWindow(cs))
returnFALSE;
returnTRUE;
}
#ifdef_DEBUG
voidCMainFrame:
:
AssertValid()const
{
CFrameWnd:
:
AssertValid();
}
voidCMainFrame:
:
Dump(CDumpContext&dc)const
{
CFrameWnd:
:
Dump(dc);
}
#endif
Lesson4_Draw.cpp:
Definestheclassbehaviorsfortheapplication.
#include"stdafx.h"
#include"Lesson4_Draw.h"
#include"MainFrm.h"
#include"Lesson4_DrawDoc.h"
#include"Lesson4_DrawView.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
BEGIN_MESSAGE_MAP(CLesson4_DrawApp,CWinApp)
ON_COMMAND(ID_FILE_NEW,CWinApp:
:
OnFileNew)
ON_COMMAND(ID_FILE_OPEN,CWinApp:
:
OnFileOpen)
ON_COMMAND(ID_FILE_PRINT_SETUP,CWinApp:
:
OnFilePrintSetup)
END_MESSAGE_MAP()
CLesson4_DrawApp:
:
CLesson4_DrawApp(){}
CLesson4_DrawApptheApp;
BOOLCLesson4_DrawApp:
:
InitInstance()
{
AfxEnableControlContainer();
#ifdef_AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();//CallthiswhenlinkingtoMFCstatically
#endif
SetRegistryKey(_T("LocalAppWizard-GeneratedApplications"));
LoadStdProfileSettings();
CSingleDocTemplate*pDocTemplate;
pDocTemplate=newCSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLesson4_DrawDoc),
RUNTIME_CLASS(CMainFrame),RUNTIME_CLASS(CLesson4_DrawView));
AddDocTemplate(pDocTemplate);
CCommandLineInfocmdInfo;
ParseCommandLine(cmdInfo);
if(!
ProcessShellCommand(cmdInfo))
returnFALSE;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
returnTRUE;
}
classCAboutDlg:
publicCDialog
{
public:
CAboutDlg();
protected:
virtualvoidDoDataExchange(CDataExchange*pDX);
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg:
:
CAboutDlg():
CDialog(CAboutDlg:
:
IDD){}
voidCAboutDlg:
:
DoDataExchange(CDataExchange*pDX)
{
CDialog:
:
DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
END_MESSAGE_MAP()
voidCLesson4_DrawApp:
:
OnAppAbout()
{
CAboutDlgaboutDlg;
aboutDlg.DoModal();
}
Lesson4_DrawDoc.cpp:
implementationoftheCLesson4_DrawDocclass
#include"Lesson4_Draw.h"
#include"Lesson4_DrawDoc.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
IMPLEMENT_DYNCREATE(CLesson4_DrawDoc,CDocument)
BEGIN_MESSAGE_MAP(CLesson4_DrawDoc,CDocument)
END_MESSAGE_MAP()
CLesson4_DrawDoc:
:
CLesson4_DrawDoc(){}
CLesson4_DrawDoc:
:
~CLesson4_DrawDoc(){}
BOOLCLesson4_DrawDoc:
:
OnNewDocument()
{
if(!
CDocument:
:
OnNewDocument())
returnFALSE;
returnTRUE;
}
voidCLesson4_DrawDoc:
:
Serialize(CArchive&ar)
{
if(ar.IsStoring()){}
else{}
}
#ifdef_DEBUG
voidCLesson4_DrawDoc:
:
AssertValid()const
{
CDocument:
:
AssertValid();
}
voidCLesson4_DrawDoc:
:
Dump(CDumpContext&dc)const
{
CDocument:
:
Dump(dc);
}
Lesson4_DrawView.cpp:
implementationoftheCLesson4_DrawViewclass
#include"stdafx.h"
#include"Lesson4_Draw.h"
#include"Lesson4_DrawDoc.h"
#include"Lesson4_DrawView.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
IMPLEMENT_DYNCREATE(CLesson4_DrawView,CView)
BEGIN_MESSAGE_MAP(CLesson4_DrawView,CView)
//{{AFX_MSG_MAP(CLesson4_DrawView)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
ON_COMMAND(ID_FILE_PRINT,CView:
:
OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT,CView:
:
OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW,CView:
:
OnFilePrintPreview)
END_MESSAGE_MAP()
CLesson4_DrawView:
:
CLesson4_DrawView()
{
//TODO:
addconstructioncodehere
m_LBtnDown=FALSE;
m_originPoint=0;
}
CLesson4_DrawView:
:
~CLesson4_DrawView()
{
}
BOOLCLesson4_DrawView:
:
PreCreateWindow(CREATESTRUCT&cs)
{
returnCView:
:
PreCreateWindow(cs);
}
voidCLesson4_DrawView:
:
OnDraw(CDC*pDC)
{
CLesson4_DrawDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
}
BOOLCLesson4_DrawView:
:
OnPreparePrinting(CPrintInfo*pInfo)
{
returnDoPreparePrinting(pInfo);
}
voidCLesson4_DrawView:
:
OnBeginPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
{}
voidCLesson4_DrawView:
:
OnEndPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
{}
#ifdef_DEBUG
voidCLesson4_DrawView:
:
AssertValid()const
{
CView:
:
AssertValid();
}
voidCLesson4_DrawView:
:
Dump(CDumpContext&dc)const
{
CView:
:
Dump(dc);
}
CLesson4_DrawDoc*CLesson4_DrawView:
:
GetDocument()
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLesson4_DrawDoc)));
return(CLesson4_DrawDoc*)m_pDocument;
}
voidCLesson4_DrawView:
:
OnLButtonDown(UINTnFlags,CPointpoint)
{
m_originPoint=point;
m_LBtnDown=TRUE;
CView:
:
OnLButtonDown(nFlags,point);
}
voidCLesson4_DrawView:
:
OnLButtonUp(UINTnFlags,CPointpoint)
{
m_LBtnDown=FALSE;
CView:
:
OnLButtonUp(nFlags,point);
}
voidCLesson4_DrawView:
:
OnMouseMove(UINTnFlags,CPointpoint)
{
CClientDCdc(this);
CPenpen(PS_SOLID,1,RGB(0,255,0));
CPen*pOldPen=dc.SelectObject(&pen);
if(m_LBtnDown==TRUE){
dc.MoveTo(m_originPoint);
dc.LineTo(point);
m_originPoint=point;
}
dc.SelectObject(pOldPen);
CView:
:
OnMouseMove(nFlags,point);}
Ref