制作 MDI窗体

1 利用向导生成MDI框架

2 如果不想默认打开默然的子窗体,则在:App类中InitInstance() 中修改以下:

 /*
 pDocTemplate = new CMultiDocTemplate(
  IDR_OAIMTYPE,
  RUNTIME_CLASS(COAIMDoc),
  RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  RUNTIME_CLASS(COAIMView));
 */
 pDocTemplate = new CMultiDocTemplate(
  IDR_OAIMTYPE,
  NULL,    //为NUll
  RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  RUNTIME_CLASS(COAIMView));

以下代码注释:

// Parse command line for standard shell commands, DDE, file open
 //CCommandLineInfo cmdInfo;
 //ParseCommandLine(cmdInfo);

 // Dispatch commands specified on the command line
 //if (!ProcessShellCommand(cmdInfo))
 // return FALSE;

3 如果想打开自己做的窗体做为默认的子窗体:

       新增一个窗体,按 ctrl+W 新建类,选择基类是:  CFormView.设计完窗体的界面后,千万切记:改变窗体的Style为Child

4 想直接打开,则加入一些代码到     InitInstance() 的最后:

   CChildFrame *pView=new CChildFrame;
 if (pView == NULL) return false;
 CCreateContext context;
 context.m_pNewViewClass=RUNTIME_CLASS(C*****);  //为刚才建立类的名称
 //创建
 if(!pView->LoadFrame(IDR_OAIMTYPE,WS_MAXIMIZE,pMainFrame,&context))
  return false;
 pView->InitialUpdateFrame(NULL,true);  //真正创建

5 如果想打开 Html  窗体,步骤同上,不同之处:  1 默认类为CHtmlView 2 窗体上不能有任何控件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值