MFC画图程序Word下载.docx

上传人:b****4 文档编号:17884343 上传时间:2022-12-11 格式:DOCX 页数:28 大小:50.85KB
下载 相关 举报
MFC画图程序Word下载.docx_第1页
第1页 / 共28页
MFC画图程序Word下载.docx_第2页
第2页 / 共28页
MFC画图程序Word下载.docx_第3页
第3页 / 共28页
MFC画图程序Word下载.docx_第4页
第4页 / 共28页
MFC画图程序Word下载.docx_第5页
第5页 / 共28页
点击查看更多>>
下载资源
资源描述

MFC画图程序Word下载.docx

《MFC画图程序Word下载.docx》由会员分享,可在线阅读,更多相关《MFC画图程序Word下载.docx(28页珍藏版)》请在冰豆网上搜索。

MFC画图程序Word下载.docx

defined(AFX_DRAW_H__378053F6_088F_44B7_A578_9738CBEED57F__INCLUDED_)

#defineAFX_DRAW_H__378053F6_088F_44B7_A578_9738CBEED57F__INCLUDED_

#if_MSC_VER>

1000

#pragmaonce

#endif//_MSC_VER>

#ifndef__AFXWIN_H__

#errorinclude'

stdafx.h'

beforeincludingthisfileforPCH

#endif

#include"

resource.h"

//mainsymbols

/////////////////////////////////////////////////////////////////////////////

//CDrawApp:

//SeeDraw.cppfortheimplementationofthisclass

classCDrawApp:

publicCWinApp

{

public:

CDrawApp();

DECLARE_MESSAGE_MAP()

};

//DrawDoc.h:

interfaceoftheCDrawDocclass

/////////////////////////////////////////////////////////////////////

defined(AFX_DRAWDOC_H__32E35C56_2489_4948_8AD0_DF51F96B20E1__INCLUDED_)

#defineAFX_DRAWDOC_H__32E35C56_2489_4948_8AD0_DF51F96B20E1__INCLUDED_

Line.h"

#include<

afxtempl.h>

classCDrawDoc:

publicCDocument

protected:

//createfromserializationonly

CDrawDoc();

DECLARE_DYNCREATE(CDrawDoc)

intGetNumLines();

voidAddLine(CPointpt1,CPointpt2);

CLine*GetLine(intnIndex);

virtual~CDrawDoc();

#ifdef_DEBUG

virtualvoidAssertValid()const;

virtualvoidDump(CDumpContext&

dc)const;

CTypedPtrArray<

CObArray,CLine*>

m_LineArray;

//DrawView.h:

interfaceoftheCDrawViewclass

defined(AFX_DRAWVIEW_H__537E5681_BEE5_44E4_9C81_F607277F4415__INCLUDED_)

#defineAFX_DRAWVIEW_H__537E5681_BEE5_44E4_9C81_F607277F4415__INCLUDED_

classCDrawView:

publicCScrollView

CDrawView();

DECLARE_DYNCREATE(CDrawView)

CDrawDoc*GetDocument();

COLORREFm_nColor;

COLORREFm_fColor;

CPointcpoint;

CPointopoint;

BOOLm_Down;

intw;

intshape;

OnPreparePrinting(CPrintInfo*pInfo);

virtualvoidOnBeginPrinting(CDC*pDC,CPrintInfo*pInfo);

virtualvoidOnEndPrinting(CDC*pDC,CPrintInfo*pInfo);

virtual~CDrawView();

HCURSORm_hCross;

boolm_bDragging;

CPointm_ptBegin;

afx_msgvoidOnPaint();

afx_msgvoidOnhuifu();

#ifndef_DEBUG//debugversioninDrawView.cpp

inlineCDrawDoc*CDrawView:

:

GetDocument()

{return(CDrawDoc*)m_pDocument;

}

//Line.h:

interfacefortheCLineclass.

defined(AFX_LINE_H__1DE25D19_06FE_4CF3_A60F_A5072A8E61A7__INCLUDED_)

#defineAFX_LINE_H__1DE25D19_06FE_4CF3_A60F_A5072A8E61A7__INCLUDED_

classCLine:

publicCObject

voidDrawLine(CDC*pDC);

CLine(CPointpt1,CPointpt2);

CLine();

virtual~CLine();

voidSerialize(CArchive&

ar);

//类CLine的序列化函数

DECLARE_SERIAL(CLine)//声明序列化类CLine

private:

CPointm_pt2;

CPointm_pt1;

//MainFrm.h:

interfaceoftheCMainFrameclass

defined(AFX_MAINFRM_H__0CDCF56E_36A1_43BE_9370_67E1222CD397__INCLUDED_)

#defineAFX_MAINFRM_H__0CDCF56E_36A1_43BE_9370_67E1222CD397__INCLUDED_

classCMainFrame:

publicCFrameWnd

CToolBarm_drawToolBar;

CMainFrame();

DECLARE_DYNCREATE(CMainFrame)

virtual~CMainFrame();

CStatusBarm_wndStatusBar;

CToolBarm_wndToolBar;

//{{NO_DEPENDENCIES}}

//MicrosoftDeveloperStudiogeneratedincludefile.

//UsedbyDraw.rc

#defineIDD_ABOUTBOX100

#defineIDR_MAINFRAME128

#defineIDR_DRAWTYPE129

#defineIDR_TOOLBAR1130

#defineID_LINE32771

#defineID_RECT32772

#defineID_ELLIPSE32773

#defineID_W132774

#defineID_W232775

#defineID_W332776

#defineID_W432777

#defineID_W532778

#defineID_COLOR32780

#defineID_FILLCOLOR32781

#defineID_huifu32786

//Nextdefaultvaluesfornewobjects

//

#ifdefAPSTUDIO_INVOKED

#ifndefAPSTUDIO_READONLY_SYMBOLS

#define_APS_3D_CONTROLS1

#define_APS_NEXT_RESOURCE_VALUE132

#define_APS_NEXT_COMMAND_VALUE32787

#define_APS_NEXT_CONTROL_VALUE1000

#define_APS_NEXT_SYMED_VALUE101

//stdafx.h:

includefileforstandardsystemincludefiles,

//orprojectspecificincludefilesthatareusedfrequently,but

//arechangedinfrequently

defined(AFX_STDAFX_H__65BC9533_FB09_4FF8_B4BB_2E1D9BD6488A__INCLUDED_)

#defineAFX_STDAFX_H__65BC9533_FB09_4FF8_B4BB_2E1D9BD6488A__INCLUDED_

#defineVC_EXTRALEAN//Excluderarely-usedstufffromWindowsheaders

afxwin.h>

//MFCcoreandstandardcomponents

afxext.h>

//MFCextensions

afxdisp.h>

//MFCAutomationclasses

afxdtctl.h>

//MFCsupportforInternetExplorer4CommonControls

#ifndef_AFX_NO_AFXCMN_SUPPORT

afxcmn.h>

//MFCsupportforWindowsCommonControls

源程序文件

//Draw.cpp:

Definestheclassbehaviorsfortheapplication.

stdafx.h"

Draw.h"

MainFrm.h"

DrawDoc.h"

DrawView.h"

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=__FILE__;

//CDrawApp

BEGIN_MESSAGE_MAP(CDrawApp,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()

//CDrawAppconstruction

CDrawApp:

CDrawApp()

}

CDrawApptheApp;

BOOLCDrawApp:

InitInstance()

AfxEnableControlContainer();

#ifdef_AFXDLL

Enable3dControls();

#else

Enable3dControlsStatic();

SetRegistryKey(_T("

LocalAppWizard-GeneratedApplications"

));

LoadStdProfileSettings();

.

CSingleDocTemplate*pDocTemplate;

pDocTemplate=newCSingleDocTemplate(

IDR_MAINFRAME,

RUNTIME_CLASS(CDrawDoc),

RUNTIME_CLASS(CMainFrame),//mainSDIframewindow

RUNTIME_CLASS(CDrawView));

AddDocTemplate(pDocTemplate);

CCommandLineInfocmdInfo;

ParseCommandLine(cmdInfo);

if(!

ProcessShellCommand(cmdInfo))

returnFALSE;

m_pMainWnd->

ShowWindow(SW_SHOW);

UpdateWindow();

SetWindowText("

简单的绘图程序"

);

returnTRUE;

classCAboutDlg:

publicCDialog

CAboutDlg();

CAboutDlg:

CAboutDlg():

CDialog(CAboutDlg:

IDD)

voidCAboutDlg:

DoDataExchange(CDataExchange*pDX)

CDialog:

DoDataExchange(pDX);

BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)

voidCDrawApp:

OnAppAbout()

CAboutDlgaboutDlg;

aboutDlg.DoModal();

}

//DrawDoc.cpp:

implementationoftheCDrawDocclass

IMPLEMENT_DYNCREATE(CDrawDoc,CDocument)

BEGIN_MESSAGE_MAP(CDrawDoc,CDocument)

CDrawDoc:

CDrawDoc()

~CDrawDoc()

BOOLCDrawDoc:

OnNewDocument()

CDocument:

OnNewDocument())

voidCDrawDoc:

Serialize(CArchive&

ar)

if(ar.IsStoring())

{

m_LineArray.Serialize(ar);

//调用CObArray类的序列化函数

else

m_LineArray.Serialize(ar);

AssertValid()const

CDocument:

AssertValid();

Dump(CDumpContext&

dc)const

Dump(dc);

#endif

//CDrawDoccommands

CLine*CDrawDoc:

GetLine(intnIndex)

if(nIndex<

0||nIndex>

m_LineArray.GetUpperBound())

returnNULL;

returnm_LineArray.GetAt(nIndex);

AddLine(CPointpt1,CPointpt2)

CLine*pLine=newCLine(pt1,pt2);

m_LineArray.Add(pLine);

SetModifiedFlag();

//设置文档修改标

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

当前位置:首页 > 求职职场 > 简历

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

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