Question about splitting forms under a single document

Source: Internet
Author: User

Recently, I encountered a problem where I needed to split the form. After several days of query, I found a lot of code, but many of them were unavailable. After deletion and selection, I selected several reasonable ones for your reference:

The first good code:

// Member variable Declaration
Cfixsplitterwnd m_wndsplitterh; // used for horizontal cutting
Cfixsplitterwnd m_wndsplitterv; // used for longitudinal Cutting
Bool m_bcreatesplitter;

// Implement the split form
Bool cmainframe: oncreateclient (lpcreatestruct lpcs, ccreatecontext * pcontext)
{
// Mixed split view of the entire main framework
Bool bresult = m_wndsplitterv.createstatic (this, 1, 2 );
Assert (bresult );
M_wndsplitterh.createstatic (& m_wndsplitterv, ws_child | ws_visible, m_wndsplitterv.idfromrowcol ));
// Create a view for each sub-Window
M_wndsplitterv.createview (600,600, runtime_class (csceneview), csize (), pcontext );
M_wndsplitterh.createview (100,100, runtime_class (cpitchview), csize (), pcontext );
M_wndsplitterh.createview (100,100, runtime_class (cyawview), csize (), pcontext );
M_wndsplitterh.createview (2-0, runtime_class (crollview), csize (100,100), pcontext );
M_wndsplitterh.createview (100,100, runtime_class (ccontrolview), csize (), pcontext );
// Set the initialization size of the pane.
M_wndsplitterv.setrowinfo (0, ideal_rawheight, 0 );
M_bcreatesplitter = true;
// Activate sceneview so that it can receive command messages
M_wndsplitterv.setactivepane (0, 0, null );
Return bresult;
}
// Adjust the size of the corresponding form when the size of the main frame form changes.
Void cmainframe: onsize (uint ntype, int CX, int CY)
{
Cmdiframewnd: onsize (ntype, CX, CY );
Crect rect;
Getclientrect (rect );
If (m_bcreatesplitter)
{
M_wndsplitterv.setcolumninfo (0, rect. Width () * 3/4, 10 );
M_wndsplitterv.setcolumninfo (1, rect. Width () * 1/4, 10 );
M_wndsplitterh.setrowinfo (0, rect. Height ()/6, 10 );
M_wndsplitterh.setrowinfo (1, rect. Height ()/6, 10 );
M_wndsplitterh.setrowinfo (2, rect. Height ()/6, 10 );
M_wndsplitterh.setrowinfo (3, rect. Height ()/2,10 );
}
M_wndsplitterv.recalclayout ();
M_wndsplitterh.recalclayout ();
}

In this Code, the view is divided into horizontal and vertical sections, and the idea is not very clear. However, the method for changing the form size with the size of the main frame can be used for reference.

The second is reasonable:

Bool cmainframe: oncreateclient (lpcreatestruct lpcs, ccreatecontext * pcontext) {partition (this,); // create a split window // create a view partition (, runtime_class (crandomdivisionview ), csize (100,200), pcontext); m_childwnd.createstatic (& m_wndsplitter, ws_child | ws_visible, random (); // create a split window m_childwnd.createview, runtime_class (crandomdivisionview), csize (100, 100), pcontext); m_childwnd1.createstatic (& m_childwnd, ws_child | ws_visible, random (); // create the split window m_childwnd1.createview (, runtime_class (runtime) for the child window ), csize (100,100), pcontext); m_childwnd2.createstatic (& m_childwnd1, ws_child | ws_visible, random (); // create a split window m_childwnd2.createview, runtime_class (crandomdivisionview), csize (100,100), pcontext ); M_childwnd3.createstatic (& m_childwnd2, 100,100, ws_child | ws_visible, random (); // create a split window m_childwnd3.createview (, runtime_class (partition), csize () for the Child Window ), pcontext); m_childwnd3.createview (100,100, runtime_class (crandomdivisionview), csize (), pcontext); Return true; // set the return value // return cframewnd: oncreateclient (lpcs, pcontext ); // do not call the method of the base class} The childwnd should be the wndsplitter object _ Wndsplitterh and m_wndsplitterv have many clear ideas. You can clearly figure out which part of the code is separated in the subwindow, and assign the view after the split, use createstatic to separate the form that needs to be split again, and mark 1, 2, and 3 in childwnd. It feels that the hierarchy is much better, and the number of minutes is not messy.
Method 3:
Bool cmainframe: oncreateclient (lpcreatestruct/* lpcs */, ccreatecontext * pcontext) {// create a static column partition window, which consists of three rows and one column if (m_wndsplitter1.createstatic (this, 3,1) = NULL) return false; // connect ccuteftpview to values (100,100, runtime_class (ccuteftpview), csize (), pcontext), m_wndsplitter1.createview (, 0, runtime_class (cview4), csize (100,100), pcontext); // connect cview4 to 0 rows and 2 columns if (m_wndsplitter2.createstatic (& m_wndsplitter, ws_child | ws_visible, merge (1, 0) = NULL) return false; // separate the 0 columns of the 1st rows and the 2 columns of the 1 row // connect the cview2 class to the 0 columns of the second column object m_wndsplitter2.createview (0, 0, runtime_class (cview2 ), csize (400,300), pcontext); // connect the cview3 class to the 0 rows and 1 columns of the second column object m_wndsplitter2.createview (400,300, runtime_class (cview3), csize (), pcontext ); return true ;}
To be honest, the brother did not understand this, and the IF statement in it did not. The brother did not understand it. He hoped to explain it to the younger brother.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.