VC程序设计大作业熊武Word格式文档下载.doc
- 文档编号:13162601
- 上传时间:2022-10-07
- 格式:DOC
- 页数:9
- 大小:124.50KB
VC程序设计大作业熊武Word格式文档下载.doc
《VC程序设计大作业熊武Word格式文档下载.doc》由会员分享,可在线阅读,更多相关《VC程序设计大作业熊武Word格式文档下载.doc(9页珍藏版)》请在冰豆网上搜索。
2思路
首先点击鼠标,选中左上角,然后拖动鼠标,在右下角拿起,这样矩形就就可以实现了。
3程序实现过程
首先建立MFC单文档程序
然后建立类向导
添加鼠标事件
添加CPoint成员变量m_OrigPoint
4关键代码
//RectangleView.cpp:
implementationoftheCRectangleViewclass
//
#include"
stdafx.h"
Rectangle.h"
RectangleDoc.h"
RectangleView.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//CRectangleView
IMPLEMENT_DYNCREATE(CRectangleView,CView)
BEGIN_MESSAGE_MAP(CRectangleView,CView)
//{{AFX_MSG_MAP(CRectangleView)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
//Standardprintingcommands
ON_COMMAND(ID_FILE_PRINT,CView:
:
OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT,CView:
ON_COMMAND(ID_FILE_PRINT_PREVIEW,CView:
OnFilePrintPreview)
END_MESSAGE_MAP()
//CRectangleViewconstruction/destruction
CRectangleView:
CRectangleView()
{
//TODO:
addconstructioncodehere
}
~CRectangleView()
BOOLCRectangleView:
PreCreateWindow(CREATESTRUCT&
cs)
ModifytheWindowclassorstylesherebymodifying
//theCREATESTRUCTcs
returnCView:
PreCreateWindow(cs);
//CRectangleViewdrawing
voidCRectangleView:
OnDraw(CDC*pDC)
CRectangleDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
adddrawcodefornativedatahere
//CRectangleViewprinting
OnPreparePrinting(CPrintInfo*pInfo)
//defaultpreparation
returnDoPreparePrinting(pInfo);
OnBeginPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addextrainitializationbeforeprinting
OnEndPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addcleanupafterprinting
//CRectangleViewdiagnostics
AssertValid()const
CView:
AssertValid();
Dump(CDumpContext&
dc)const
Dump(dc);
CRectangleDoc*CRectangleView:
GetDocument()//non-debugversionisinline
ASSERT(m_pDocument->
IsKindOf(RUNTIME_CLASS(CRectangleDoc)));
return(CRectangleDoc*)m_pDocument;
#endif//_DEBUG
//CRectangleViewmessagehandlers
OnLButtonDown(UINTnFlags,CPointpoint)
Addyourmessagehandlercodehereand/orcalldefault
this->
m_OrigPoint=point;
OnLButtonDown(nFlags,point);
OnLButtonUp(UINTnFlags,CPointpoint)
CClientDCdc(this);
dc.Rectangle(CRect(m_OrigPoint,point));
OnLButtonUp(nFlags,point);
5输入输出情况及截图
6总结体会
通过前期对VC++的学习和这次大作业,我对VC++有了进一步的认识,而且熟悉了如何建立单文档程序,多文档等程序,对VisualC++6.0开发环境有了进一步了解,最重要的一点是我知道自己还有很多VC++知识要学,目前学到的知识只是一点皮毛而已,以后一定会更加努力,虽然VC++不是我的专业课,我们对它的要求也不是特别高,但是我觉得我以后还是会学一学这个的,多掌握一门编程语言,而且VC++在图形化编程里面用的还是比较广泛的,对我们的未来的发展只有好处,没有坏处!
熊武——VC++大作业
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VC 程序设计 作业