Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3362410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:16:15+00:00 2026-05-18T03:16:15+00:00

I am working with MFC MDI. I need to create views as follow. My

  • 0

I am working with MFC MDI. I need to create views as follow. My ChildWnd is splitted in 2 parts. They are LeftView which is a CView and RightView which is a CScrollView. The LeftView is splitted in 2 parts, the TreeView and the the FormView. How can I do that?

_________________________________
|          |                    |
|          |                    |
|CTreeView  |                   |
|          |                    |
|          |                    |
|          |        CScrollView |
|___________|                   |
|          |                    |
|          |                    |
|CFormView  |                   |
|          |                    |
|          |                    |
----------------------------------
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T03:16:16+00:00Added an answer on May 18, 2026 at 3:16 am

    I finally solved this problem. I wrote the solution for anyone who has a similar problem.

    1. In CChildFrame class, declare CSplitterWnd m_SplitterWnd;

    2. In CChildFrame ::OnCreateClient put the following code:

      if(!m_SplitterWnd.CreateStatic(this, 1, 2))
      {
          TRACE("Failed to create splitter window");
          return FALSE;
      }
      pContext->m_pNewViewClass = RUNTIME_CLASS(CLeftView);
      m_SplitterWnd.CreateView(0, 0, pContext->m_pNewViewClass, CSize(0, 0), pContext);
      m_pLeftView=(CLeftView*)m_SplitterWnd.GetPane(0,0);
      CCreateContext context;
      context.m_pNewViewClass = pContext->m_pNewViewClass; //save original
      
      pContext->m_pNewViewClass = RUNTIME_CLASS(CRightView);
      m_SplitterWnd.CreateView(0, 1, pContext->m_pNewViewClass, CSize(0, 0), pContext);
      pContext->m_pNewViewClass = context.m_pNewViewClass; //return to original
      m_pRightView=(CRightView*)m_SplitterWnd.GetPane(0,1);
      
      int nWidth=rc.Width();
      m_SplitterWnd.SetColumnInfo(0, nWidth*0.25, 50);
      m_SplitterWnd.SetColumnInfo(1, nWidth*0.75, 50);
      

      CLeftView is an MFC CView derived class.

    3. In CLeftView declare a member variable CSplitterWnd m_SplitterWnd;

    4. In CLeftView::OnCreate, add the following code:

      CCreateContext *pContext = (CCreateContext*) lpCreateStruct->lpCreateParams;
      
      if(!m_SplitterWnd.CreateStatic(this, 2, 1, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST+8))
      {
          TRACE("Failed to create splitter window");
          return FALSE;
      }
      pContext->m_pNewViewClass = RUNTIME_CLASS(CPhongView);
      m_SplitterWnd.CreateView(0, 0, pContext->m_pNewViewClass, CSize(0, 0), pContext);
      m_pPhongView=(CPhongView*)m_SplitterWnd.GetPane(0, 0);
      CCreateContext context;
      context.m_pNewViewClass = pContext->m_pNewViewClass; //save original
      
      pContext->m_pNewViewClass = RUNTIME_CLASS(CPhongInfo);
      m_SplitterWnd.CreateView(1, 0, pContext->m_pNewViewClass, CSize(0, 0), pContext);
      pContext->m_pNewViewClass = context.m_pNewViewClass; //return to original
      m_pPhongInfo=(CPhongInfo*)m_SplitterWnd.GetPane(1, 0);
      

      CPhongInfo is a CFormView derived class, CPhong View is a CTreeView class.

    5. In CLeftView::OnSize, put the following code

      m_SplitterWnd.MoveWindow(0, 0, cx, cy);
      int nRow2 = 227;
      int nRow1 = cy - 227;
      m_SplitterWnd.SetRowInfo(0, nRow1, 0);
      m_SplitterWnd.SetRowInfo(1, nRow2, 0);
      m_SplitterWnd.RecalcLayout();
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an old MFC project. Users are using Windows 7 they
i am working on a Dialog based application in MFC, I need something just
I am working on MFC SDI application, in which I include one C++ generic
I am currently working on a very large legacy MFC MDI application. It has
I'm working on a MFC C++ dialog where I need to respond to right
I have an MFC app which I have been working on for a few
I am working on application which need to develope in both windows and linux.
I'm working on an ActiveX control which is hosted in MFC and VB6 applications.
I'm working on an MFC application, that got pretty messy over years and over
I'm working on a multi-threaded win32 MFC application. We are rendering a map and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.