VC程序设计大作业熊武Word格式文档下载.doc

上传人:b****1 文档编号:13162601 上传时间:2022-10-07 格式:DOC 页数:9 大小:124.50KB
下载 相关 举报
VC程序设计大作业熊武Word格式文档下载.doc_第1页
第1页 / 共9页
VC程序设计大作业熊武Word格式文档下载.doc_第2页
第2页 / 共9页
VC程序设计大作业熊武Word格式文档下载.doc_第3页
第3页 / 共9页
VC程序设计大作业熊武Word格式文档下载.doc_第4页
第4页 / 共9页
VC程序设计大作业熊武Word格式文档下载.doc_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

VC程序设计大作业熊武Word格式文档下载.doc

《VC程序设计大作业熊武Word格式文档下载.doc》由会员分享,可在线阅读,更多相关《VC程序设计大作业熊武Word格式文档下载.doc(9页珍藏版)》请在冰豆网上搜索。

VC程序设计大作业熊武Word格式文档下载.doc

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++大作业

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试认证 > IT认证

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1