資源簡介
vc++單文檔多視圖例子,同一個視圖分為多個視圖,利用相關類,是初學者很好的范例

代碼片段和文件信息
//?MainFrm.cpp?:?implementation?of?the?CMainframe?class
//
#include?“stdafx.h“
#include?“test.h“
#include?“MainFrm.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CMainframe
IMPLEMENT_DYNCREATE(CMainframe?CframeWnd)
BEGIN_MESSAGE_MAP(CMainframe?CframeWnd)
//{{AFX_MSG_MAP(CMainframe)
ON_WM_CREATE()
ON_COMMAND(ID_BUTTON32771?OnButton32771)
ON_COMMAND(ID_BUTTON32772?OnButton32772)
ON_COMMAND(ID_BUTTON32773?OnButton32773)
ON_COMMAND(ID_BUTTON32774?OnButton32774)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static?UINT?indicators[]?=
{
ID_SEPARATOR???????????//?status?line?indicator
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?construction/destruction
CMainframe::CMainframe()
{
//?TODO:?add?member?initialization?code?here
}
CMainframe::~CMainframe()
{
}
int?CMainframe::OnCreate(LPCREATESTRUCT?lpCreateStruct)
{
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(“Failed?to?create?toolbar\n“);
return?-1;??????//?fail?to?create
}
//? VERIFY(m_wndToolBar.CreateEx(this));
//? VERIFY(m_wndToolBar.LoadToolBar(IDR_MAINframe));
HBITMAP?hBitMap?=?(HBITMAP)::LoadImage(AfxGetInstanceHandle()?MAKEINTRESOURCE(IDR_MAINframe)?IMAGE_BITMAP?0?0?LR_CREATEDIBSECTION?|?LR_LOADMAP3DCOLORS);
CBitmap?btp;
btp.Attach(hBitMap);
m_imgList.Create(32?32?ILC_COLOR8?4?4);
m_imgList.Add(&btp?(CBitmap*)NULL);
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_imgList);
if?(!m_wndStatusBar.Create(this)?||
!m_wndStatusBar.SetIndicators(indicators
??sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“Failed?to?create?status?bar\n“);
return?-1;??????//?fail?to?create
}
//?TODO:?Delete?these?three?lines?if?you?don‘t?want?the?toolbar?to
//??be?dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return?0;
}
BOOL?CMainframe::PreCreateWindow(CREATESTRUCT&?cs)
{
if(?!CframeWnd::PreCreateWindow(cs)?)
return?FALSE;
//?TODO:?Modify?the?Window?class?or?styles?here?by?modifying
//??the?CREATESTRUCT?cs
return?TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?diagnostics
#ifdef?_DEBUG
void?CMainframe::AssertValid()?const
{
CframeWnd::AssertValid();
}
void?CMainframe::Dump(CDumpContext&?dc)?const
{
CframeWnd::Dump(dc);
}
#endif?//_DEBUG
/////////////////////////////////////////////////////////////////////////////
//?CMainframe?message?handlers
void?CM
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-09-06?10:30??單文檔?FormView例子\
?????文件????????3359??2011-09-02?14:20??單文檔?FormView例子\MainFrm.cpp
?????文件????????1604??2011-09-02?14:20??單文檔?FormView例子\MainFrm.h
?????文件????????4263??2011-09-02?14:16??單文檔?FormView例子\ReadMe.txt
?????目錄???????????0??2011-09-06?10:30??單文檔?FormView例子\res\
?????文件?????????962??2011-09-02?15:01??單文檔?FormView例子\resource.h
?????文件????????1078??2011-09-02?14:16??單文檔?FormView例子\res\test.ico
?????文件?????????396??2011-09-02?14:16??單文檔?FormView例子\res\test.rc2
?????文件????????1078??2011-09-02?14:16??單文檔?FormView例子\res\testDoc.ico
?????文件????????2166??2011-09-02?14:19??單文檔?FormView例子\res\Toolbar.bmp
?????文件????????1501??2011-09-02?17:03??單文檔?FormView例子\SpecialEdit.cpp
?????文件????????1283??2011-09-02?15:27??單文檔?FormView例子\SpecialEdit.h
?????文件?????????206??2011-09-02?14:16??單文檔?FormView例子\StdAfx.cpp
?????文件????????1054??2011-09-02?14:16??單文檔?FormView例子\StdAfx.h
?????文件???????45608??2011-09-02?15:01??單文檔?FormView例子\test.aps
?????文件????????2583??2011-09-02?16:32??單文檔?FormView例子\test.clw
?????文件????????4173??2011-09-02?14:16??單文檔?FormView例子\test.cpp
?????文件????????4651??2011-09-02?17:41??單文檔?FormView例子\test.dsp
?????文件?????????533??2011-09-02?17:41??單文檔?FormView例子\test.dsw
?????文件????????1334??2011-09-02?14:16??單文檔?FormView例子\test.h
?????文件???????58368??2011-09-06?09:53??單文檔?FormView例子\test.ncb
?????文件???????56832??2011-09-06?09:53??單文檔?FormView例子\test.opt
?????文件????????1403??2011-09-06?09:53??單文檔?FormView例子\test.plg
?????文件???????11877??2011-09-02?15:01??單文檔?FormView例子\test.rc
?????文件????????1702??2011-09-02?14:16??單文檔?FormView例子\testDoc.cpp
?????文件????????1453??2011-09-02?14:16??單文檔?FormView例子\testDoc.h
?????文件????????3040??2011-09-06?09:53??單文檔?FormView例子\testView.cpp
?????文件????????2181??2011-09-02?15:00??單文檔?FormView例子\testView.h
- 上一篇:2.Newton插值公式.cpp
- 下一篇:東北大學C++實驗
評論
共有 條評論