« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
|
公告 |
本站技术贴除标明为“原创”的之外,其余均为网上转载,文中我会尽量保留原作者姓名,若有侵权请与我联系,我将第一时间做出修改。谢谢!
——既瑜 |
统计 |
blog名称:★既瑜★ 日志总数:183 评论数量:636 留言数量:-25 访问次数:1406322 建立时间:2005年3月12日 |
OICQ:215768265
njucs2001@hotmail.com
erichoo1982@gmail.com |
|
W3CHINA Blog首页 管理页面 写新日志 退出
[【技术文档】]如何实现 SDI 与 MDI 的转换? |
如何实现 SDI 与 MDI 的转换? 你可以这样做:建立一个继承于 CMDIChidWnd 的类,不防设为 CChldFrm。在 CWinApp 中 作如下变化。 InitInstance() { . ... /// After this it is required to create the main frame window // which will contain all the child windows. Now this window is // what was initially frame window for SDI. CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; //instead of adding CSingleDocTemplate // Add CMultiDocTemplate. pDocTemplate = new CMultiDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CSDIDoc), RUNTIME_CLASS(CChldFrm), // For Main MDI Frame change this frame window from // CFrameWnd derivative ( i.e. CMainFrame ) // to your CMDIChildWnd derived CChldFrm. RUNTIME_CLASS(CSDIView)); ..... } 在从 CMDIFrameWnd 中继承的类 CMainFrame 代替 CFramWnd 后,所有的类都将从 C MDIFrame 继承,而不是 CFrameWnd,编译运行后你就会发现程序已经从 SDI 变换到 MDI 。其他相关地方也要修改。 注意:在 CMainFram 中必须将构造函数从 private 改为 public,否则会出错。 一个实例:http://bbs1.nju.edu.cn/file/hl 添加扩展名.rar,密码为HeLiang
|
阅读全文(1377) | 回复(0) | 编辑 | 精华 |
|