友情提示:如果本网页打开太慢或显示不完整,请尝试鼠标右键“刷新”本网页!
第三电子书 返回本书目录 加入书签 我的书架 我的书签 TXT全本下载 『收藏到我的浏览器』

深入浅出MFC第2版(PDF格式)-第55部分

快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部! 如果本书没有阅读完,想下次继续接着阅读,可使用上方 "收藏到我的浏览器" 功能 和 "加入书签" 功能!


                   #0019 

                   #0020  BEGIN_MESSAGE_MAP(CMainFrame; CMDIFrameWnd) 

                   #0021   //{{AFX_MSG_MAP(CMainFrame) 

                   #0022       // NOTE the ClassWizard will add and remove mapping macros here。 

                   #0023       //    DO NOT EDIT what you see in these blocks of generated code ! 

                   #0024   ON_WM_CREATE() 

                   #0025   //}}AFX_MSG_MAP 

                   #0026  END_MESSAGE_MAP() 

                   #0027 

                   #0028  static UINT indicators'' = 

                   #0029  { 

                   #0030   ID_SEPARATOR;           // status line indicator 

                   #0031   ID_INDICATOR_CAPS; 

                   #0032   ID_INDICATOR_NUM; 

                   #0033   ID_INDICATOR_SCRL; 



280 


…………………………………………………………Page 343……………………………………………………………

                                             第4章    Visual C++  整合性軟體開發環境 



#0034  }; 

#0035 

#0036  ///////////////////////////////////////////////////////////////// 

#0037  // CMainFrame construction/destruction 

#0038 

#0039  CMainFrame::CMainFrame() 

#0040  { 

#0041   // TODO: add member initialization code here 

#0042 

#0043  } 

#0044 

#0045  CMainFrame::~CMainFrame() 

#0046  { 

#0047  } 

#0048 

#0049  int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 

#0050  { 

#0051   if (CMDIFrameWnd::OnCreate(lpCreateStruct) == …1) 

#0052           return …1; 

#0053 

#0054   if (!m_wndToolBar。Create(this) || 

#0055           !m_wndToolBar。LoadToolBar(IDR_MAINFRAME)) 

#0056   { 

#0057           TRACE0(〃Failed to create toolbarn〃); 

#0058           return …1;      // fail to create 

#0059   } 

#0060 

#0061   if (!m_wndStatusBar。Create(this) || 

#0062           !m_wndStatusBar。SetIndicators(indicators; 

#0063             sizeof(indicators)/sizeof(UINT))) 

#0064   { 

#0065           TRACE0(〃Failed to create status barn〃); 

#0066           return …1;      // fail to create 

#0067   } 

#0068 

#0069   // TODO: Remove this if you don't want tool tips or a resizeable toolbar 

#0070   m_wndToolBar。SetBarStyle(m_wndToolBar。GetBarStyle() | 

#0071           CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); 

#0072 

#0073   // TODO: Delete these three lines if you don't want the toolbar to 

#0074   //  be dockable 

#0075   m_wndToolBar。EnableDocking(CBRS_ALIGN_ANY); 

#0076   EnableDocking(CBRS_ALIGN_ANY); 

#0077   DockControlBar(&m_wndToolBar); 

#0078 

#0079   return 0; 



                                                                                      281 


…………………………………………………………Page 344……………………………………………………………

                  第篇    欲善工事先利其器 



                  #0080  } 

                  #0081 

                  #0082  BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 

                  #0083  { 

                  #0084   // TODO: Modify the Window class or styles here by modifying 

                  #0085   //  the CREATESTRUCT cs 

                  #0086 

                  #0087   return CMDIFrameWnd::PreCreateWindow(cs); 

                  #0088  } 

                  #0089 

                  #0090  ///////////////////////////////////////////////////////////////// 

                  #0091  // CMainFrame diagnostics 

                  #0092 

                  #0093  #ifdef _DEBUG 

                  #0094  void CMainFrame::AssertValid() const 

                  #0095  { 

                  #0096   CMDIFrameWnd::AssertValid(); 

                  #0097  } 

                  #0098 

                  #0099  void CMainFrame::Dump(CDumpContext& dc) const 

                  #0100  { 

                  #0101   CMDIFrameWnd::Dump(dc); 

                  #0102  } 

                  #0103 

                  #0104  #endif //_DEBUG 

                  #0105 

                  #0106  ///////////////////////////////////////////////////////////////// 

                  #0107  // CMainFrame message handlers 



                  CHILDFRM。CPP 



                  #0001  // ChildFrm。cpp : implementation of the CChildFrame class 

                  #0002  // 

                  #0003 

                  #0004  #include 〃stdafx。h〃 

                  #0005  #include 〃Scribble。h〃 

                  #0006 

                  #0007  #include 〃ChildFrm。h〃 

                  #0008 

                  #0009  #ifdef _DEBUG 

                  #0010  #define new DEBUG_NEW 

                  #0011  #undef THIS_FILE 

                  #0012  static char THIS_FILE'' = __FILE__; 

                  #0013  #endif 

                  #0014 

                  #0015  ///////////////////////////////////////////////////////////////// 



282 


…………………………………………………………Page 345……………………………………………………………

                                             第4章    Visual C++  整合性軟體開發環境 



#0016  // CChildFrame 

#0017 

#0018  IMPLEMENT_DYNCREATE(CChildFrame; CMDIChildWnd) 

#0019 

#0020  BEGIN_MESSAGE_MAP(CChildFrame; CMDIChildWnd) 

#0021   //{{AFX_MSG_MAP(CChildFrame) 

#0022        // NOTE the ClassWizard will add and remove mapping macros here。 

#0023        //   DO NOT EDIT what you see in these blocks of generated code ! 

#0024   //}}AFX_MSG_MAP 

#0025  END_MESSAGE_MAP() 

#0026 

#0027  ///////////////////////////////////////////////////////////////// 

#0028  // CChildFrame construction/destruction 

#0029 

#0030  CChildFrame::CChildFrame() 

#0031  { 

#0032   // TODO: add member initialization code here 

#0033 

#0034  } 

#0035 

#0036  CChildFrame::~CChildFrame() 

#0037  { 

#0038  } 

#0039 

#0040  BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) 

#0041  { 

#0042   // TODO: Modify the Window class or styles here by modifying 

#0043   //  the CREATESTRUCT cs 

#0044 

#0045   return CMDIChildWnd::PreCreateWindow(cs); 

#0046  } 

#0047 

#0048  ///////////////////////////////////////////////////////////////// 

#0049  // CChildFrame diagnostics 

#0050 

#0051  #ifdef _DEBUG 

#0052  void CChildFrame::AssertValid() const 

#0053  { 

#0054   CMDIChildWnd::AssertValid(); 

#0055  } 

#0056 

#0057  void CChildFrame::Dump(CDumpContext& dc) const 

#0058  { 

#0059   CMDIChildWnd::Dump(dc); 

#0060  } 

#0061 



                                                                                     283 


…………………………………………………………Page 346……………………………………………………………

                   第篇    欲善工事先利其器 



                   #0062  #endif //_DEBUG 

                   #0063 

                   #0064  ///////////////////////////////////////////////////////////////// 

                   #0065  // CChildFrame message handlers 



                   SCRIBBLEDOC。CPP 



                   #0001  // ScribbleDoc。cpp : implementation of the CScribbleDoc class 

                   #0002  // 

                   #0003 

                   #0004  #include 〃stdafx。h〃 

                   #0005  #include 〃Scribble。h〃 

                   #0006 

                   #0007  #include 〃ScribbleDoc。h〃 

                   #0008 

                   #0009  #ifdef _DEBUG 

                   #0010  #define new DEBUG_NEW 

                   #0011  #undef THIS_FILE 

                   #0012  static char THIS_FILE'' = __FILE__; 

                   #0013  #endif 

                   #0014 

                   #0015  ///////////////////////////////////////////////////////////////// 

                   #0016  // CScribbleDoc 

                   #0017 

                   #0018  IMPLEMENT_DYNCREATE(CScribbleDoc; CDocument) 

                   #0019 

                   #0020  BEGIN_MESSAGE_MAP(CScribbleDoc; CDocument) 

                   #0021   //{{AFX_MSG_MAP(CScribbleDoc) 

                   #0022       // NOTE the ClassWizard will add and remove mapping macros here。 

                   #0023       //    DO NOT EDIT what you see in these blocks of generated code! 

                   #0024   //}}AFX_MSG_MAP 

                   #0025  END_MESSAGE_MAP() 

                   #0026 

                   #0027  ///////////////////////////////////////////////////////////////// 

                   #0028  // CScribbleDoc construction/destruction 

                   #0029 

                   #0030  CScribbleDoc::CScribbleDoc() 

                   #0031  { 

                   #0032   // TODO: add one…time construction code here 

                   #0033 

                   #0034  } 

                   #0035 

                   #0036  CScribbleDoc::~CScribbleDoc() 

                   #0037  { 

                   #0038  } 

                   #0039 



284 


…………………………………………………………Page 347……………………………………………………………

                                            第4章    Visual C++  整合性軟體開發環境 



#0040  BOOL CScribbleDoc::OnNewDocument() 

#0041  { 

#0042   if (!CDocument::OnNewDocument()) 

#0043           return FALSE; 

#0044 

#0045   // TODO: add reinitialization code here 

#0046   // (SDI documents will reuse this document) 

#0047 

#0048   return TRUE; 

#0049  } 

#0050 

#0051  ///////////////////////////////////////////////////////////////// 

#0052  // CScribbleDoc serialization 

#0053 

#0054  void CScribbleDoc::Serialize(CArchive& ar) 

#0055  { 

#0056   if (ar。IsStoring()) 

#0057   { 

#0058           // TODO: add storing code here 

#0059   } 

#0060   else 

#0061   { 

#0062           // TODO: add loading code here 

#0063   } 

#0064  } 

#0065 

#0066  ///////////////////////////////////////////////////////////////// 

#0067  // CScribbleDoc diagnostics 

#0068 

#0069  #ifdef _DEBUG 

#0070  void CScribbleDoc::AssertValid() const 

#0071  { 

#0072   CDocument::AssertValid(); 

#0073  } 

#0074 

#0075  void CScribbleDoc::Dump(CDumpContext& dc) const 

#0076  { 

#0077   CDocument::Dump(dc); 

#0078  } 

#0079  #endif //_DEBUG 

#0080 

#0081  ///////////////////////////////////////////////////////////////// 

#0082  // CScribbleDoc mands 



                                                                                   285 


…………………………………………………………Page 348……………………………………………………………

                   第篇    欲善工事先利其器 



                   SCRIBBLEVIEW。CPP 



                   #0001  // ScribbleView。cpp : implementation of the CScribbleView class 

                   #0002  // 

                   #0003 

                   #0004  #include 〃stdafx。h〃 

                   #0005  #include 〃Scribble。h〃 

                   #0006 

                   #0007  #include 〃ScribbleDoc。h〃 

                   #0008  #include 〃ScribbleView。h〃 

                   #0009 

                   #0010  #ifdef _DEBUG 

                   #0011  #define new DEBUG_NEW 

                   #0012  #undef THIS_FILE 

          
返回目录 上一页 下一页 回到顶部 0 0
快捷操作: 按键盘上方向键 ← 或 → 可快速上下翻页 按键盘上的 Enter 键可回到本书目录页 按键盘上方向键 ↑ 可回到本页顶部!
温馨提示: 温看小说的同时发表评论,说出自己的看法和其它小伙伴们分享也不错哦!发表书评还可以获得积分和经验奖励,认真写原创书评 被采纳为精评可以获得大量金币、积分和经验奖励哦!