CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  界面

怎样在单文档中加载同一个类的界面不同的对话框?

楼主blackotomic(黑子)2003-12-02 19:42:52 在 VC/MFC / 界面 提问

现在我想在单文档中加载同一个类的界面不同的对话框,读入不同的参数数值,然后在视图中用函数调用这些参数,并在视图中显示结果.请问该怎么实现? 问题点数:0、回复次数:3Top

1 楼saucer(思归)回复于 2003-12-03 05:09:18 得分 0

Multiple   Views   Using   SDI    
  http://www.codeguru.com/doc_view/ScreenSwitch.shtml  
   
  VSWAP   Demos   Multiple-View   Switching   in   SDI  
  http://support.microsoft.com/default.aspx?kbid=141333  
  Top

2 楼broadoceans(broadoceans)回复于 2003-12-03 09:21:00 得分 0

主要是利用CDocument的AddView()和RemoveView()  
  BOOL   CMainFrame::OnViewChange(UINT   nCmdID)  
  {  
    CView*   pViewAdd;  
    CView*   pViewRemove;  
    CDocument*   pDoc   =   GetActiveDocument();  
    UINT   nCmdID;  
           
    nCmdID   =   LOWORD(GetCurrentMessage()->wParam);  
         
    if((nCmdID   ==   ID_VIEW_VIEW1)   &&   (m_currentView   ==   1))  
          return;  
    if((nCmdID   ==   ID_VIEW_VIEW2)   &&   (m_currentView   ==   2))  
        return;  
   
    if   (nCmdID   ==   ID_VIEW_VIEW2)  
    {  
      if   (m_pView2   ==   NULL)  
      {  
        m_pView1   =   GetActiveView();  
        m_pView2   =   new   CMyView2;  
   
  //Note   that   if   OnSize   has   been   overridden   in   CMyView2    
  //and   GetDocument()   is   used   in   this   override   it   can    
  //cause   assertions   and,   if   the   assertions   are   ignored,  
  //cause   access   violation.  
       
        m_pView2->Create(NULL,   NULL,   AFX_WS_DEFAULT_VIEW,  
              rectDefault,   this,   AFX_IDW_PANE_FIRST   +   1,   NULL);  
      }  
        pViewAdd   =   m_pView2;  
        pViewRemove   =   m_pView1;  
        m_currentView=   2;  
    }  
    else  
    {  
      pViewAdd   =   m_pView1;  
      pViewRemove   =   m_pView2;  
      m_currentView=   1;  
    }  
             
  //   Set   the   child   i.d.   of   the   active   view   to   AFX_IDW_PANE_FIRST,  
  //   so   that   CFrameWnd::RecalcLayout   will   allocate   to   this    
  //   "first   pane"   that   portion   of       the   frame   window's   client   area    
  //   not   allocated   to   control       bars.     Set   the   child   i.d.   of   the    
  //   other   view   to   anything   other   than   AFX_IDW_PANE_FIRST;   this  
  //   examples   switches   the   child   id's   of   the   two   views.  
   
    int   nSwitchChildID   =   pViewAdd->GetDlgCtrlID();  
    pViewAdd->SetDlgCtrlID(AFX_IDW_PANE_FIRST);  
    pViewRemove->SetDlgCtrlID(nSwitchChildID);  
   
    //   Show   the   newly   active   view   and   hide   the   inactive   view.  
   
    pViewAdd->ShowWindow(SW_SHOW);  
    pViewRemove->ShowWindow(SW_HIDE);  
   
    //   Connect   the   newly   active   view   to   the   document,   and  
    //   disconnect   the   inactive   view.  
    pDoc->AddView(pViewAdd);  
    pDoc->RemoveView(pViewRemove);  
   
    SetActiveView(pViewAdd);  
    RecalcLayout();  
  }  
  Top

3 楼wangweixing2000(星(inspiration(灵感)))回复于 2003-12-03 10:05:00 得分 0

上面已经很详细了!Top

相关问题

  • 如何在对话框的界面里添加视图和文档?
  • 关于单文档及非模式对话框界面的问题
  • 对话框界面设置
  • 对话框界面难题
  • 用一个对话框,而不用单文档界面,可以写出类似浏览器的程序吗?
  • 单文档多视界面怎样避免在程序启动时出现选择视的对话框?
  • 紧急求助,在基于CFormView的多文档界面中,如何将菜单与一个对话框关联?
  • sdk加载对话框的问题
  • 怎么样去掉文档对话框?
  • 请问如何为对话框加载菜单?(是基于对话框的MFC)。

关键词

  • view
  • ncmdid
  • pview
  • 不同

得分解答快速导航

  • 帖主:blackotomic

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo