2DotNet平台技术实验报告3Word文档下载推荐.docx
《2DotNet平台技术实验报告3Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《2DotNet平台技术实验报告3Word文档下载推荐.docx(32页珍藏版)》请在冰豆网上搜索。
![2DotNet平台技术实验报告3Word文档下载推荐.docx](https://file1.bdocx.com/fileroot1/2022-11/15/71f5f779-f2aa-4b0b-a5ef-de25082baa53/71f5f779-f2aa-4b0b-a5ef-de25082baa531.gif)
protected:
//仅从序列化创建
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
//特性
public:
//操作
//重写
virtualBOOLPreCreateWindow(CREATESTRUCT&
cs);
virtualBOOLLoadFrame(UINTnIDResource,DWORDdwDefaultStyle=WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE,CWnd*pParentWnd=NULL,CCreateContext*pContext=NULL);
//实现
virtual~CMainFrame();
#ifdef_DEBUG
virtualvoidAssertValid()const;
virtualvoidDump(CDumpContext&
dc)const;
#endif
//控件条嵌入成员
CMFCMenuBarm_wndMenuBar;
CMFCToolBarm_wndToolBar;
CMFCStatusBarm_wndStatusBar;
CMFCToolBarImagesm_UserImages;
//生成的消息映射函数
afx_msgintOnCreate(LPCREATESTRUCTlpCreateStruct);
afx_msgvoidOnViewCustomize();
(续)
afx_msgLRESULTOnToolbarCreateNew(WPARAMwp,LPARAMlp);
DECLARE_MESSAGE_MAP()
};
//MyThread.h:
MyThread应用程序的主头文件
#ifndef__AFXWIN_H__
#error"
在包含此文件之前包含“stdafx.h”以生成PCH文件"
#include"
resource.h"
//主符号
//CMyThreadApp:
//有关此类的实现,请参阅MyThread.cpp
classCMyThreadApp:
publicCWinAppEx
CMyThreadApp();
virtualBOOLInitInstance();
virtualintExitInstance();
BOOLm_bHiColorIcons;
virtualvoidPreLoadState();
virtualvoidLoadCustomState();
virtualvoidSaveCustomState();
afx_msgvoidOnAppAbout();
externCMyThreadApptheApp;
//MyThreadDoc.h:
CMyThreadDoc类的接口
classCMyThreadDoc:
publicCDocument
CMyThreadDoc();
DECLARE_DYNCREATE(CMyThreadDoc)
virtualBOOLOnNewDocument();
virtualvoidSerialize(CArchive&
ar);
#ifdefSHARED_HANDLERS
virtualvoidInitializeSearchContent();
virtualvoidOnDrawThumbnail(CDC&
dc,LPRECTlprcBounds);
#endif//SHARED_HANDLERS
virtual~CMyThreadDoc();
//用于为搜索处理程序设置搜索内容的Helper函数
voidSetSearchContent(constCString&
value);
//MyThreadView.h:
CMyThreadView类的接口
classCMyThreadView:
publicCView
CMyThreadView();
DECLARE_DYNCREATE(CMyThreadView)
CMyThreadDoc*GetDocument()const;
virtualvoidOnDraw(CDC*pDC);
//重写以绘制该视图
virtualBOOLOnPreparePrinting(CPrintInfo*pInfo);
virtualvoidOnBeginPrinting(CDC*pDC,CPrintInfo*pInfo);
virtualvoidOnEndPrinting(CDC*pDC,CPrintInfo*pInfo);
virtual~CMyThreadView();
afx_msgvoidOnFilePrintPreview();
afx_msgvoidOnRButtonUp(UINTnFlags,CPointpoint);
afx_msgvoidOnContextMenu(CWnd*pWnd,CPointpoint);
afx_msgvoidOnStartthread();
afx_msgvoidOnStopthread();
#ifndef_DEBUG//MyThreadView.cpp中的调试版本
inlineCMyThreadDoc*CMyThreadView:
:
GetDocument()const
{returnreinterpret_cast<
CMyThreadDoc*>
(m_pDocument);
}
//MainFrm.cpp:
CMainFrame类的实现
stdafx.h"
MyThread.h"
MainFrm.h"
#definenewDEBUG_NEW
//CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame,CFrameWndEx)
constintiMaxUserToolbars=10;
constUINTuiFirstUserToolBarId=AFX_IDW_CONTROLBAR_FIRST+40;
constUINTuiLastUserToolBarId=uiFirstUserToolBarId+iMaxUserToolbars-1;
BEGIN_MESSAGE_MAP(CMainFrame,CFrameWndEx)
ON_WM_CREATE()
ON_COMMAND(ID_VIEW_CUSTOMIZE,&
CMainFrame:
OnViewCustomize)
ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR,&
OnToolbarCreateNew)
END_MESSAGE_MAP()
staticUINTindicators[]=
ID_SEPARATOR,//状态行指示器
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
//CMainFrame构造/析构
CMainFrame()
//TODO:
在此添加成员初始化代码
}
~CMainFrame()
intCMainFrame:
OnCreate(LPCREATESTRUCTlpCreateStruct)
if(CFrameWndEx:
OnCreate(lpCreateStruct)==-1)
return-1;
BOOLbNameValid;
//设置用于绘制所有用户界面元素的视觉管理器
CMFCVisualManager:
SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008));
if(!
m_wndMenuBar.Create(this))
{
TRACE0("
未能创建菜单栏\n"
);
//未能创建
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle()|CBRS_SIZE_DYNAMIC|CBRS_TOOLTIPS|CBRS_FLYBY);
//防止菜单栏在激活时获得焦点
CMFCPopupMenu:
SetForceMenuFocus(FALSE);
m_wndToolBar.Creat