Home > Software engineering >  The CSplitterWnd dynamic segmentation, cannot use? Dynamic segmentation is!
The CSplitterWnd dynamic segmentation, cannot use? Dynamic segmentation is!

Time:09-26

Below is the MSDN routines, under VS2015 test, dynamic segmentation why not?

//the following function is created by the MFC Application Wizard 
//the when you select the Split window from the User Interface Features TAB:
BOOL CMyChildFrame: : OnCreateClient (LPCS LPCREATESTRUCT/* */, CCreateContext * pContext)
{
Return m_wndSplitter. Create (this,
2, 2,//TODO: adjust the number of rows, the columns
CSize (10, 10),//TODO: adjust the minimum pane size
PContext);
}


Static segmentation can be implemented, I just like to know the dynamic segmentation, where is the problem? Thank you very much!

CodePudding user response:

http://blog.csdn.net/csdnmicrosoftcsdn/article/details/47952895

CodePudding user response:

reference 1st floor zgl7903 response:
http://blog.csdn.net/csdnmicrosoftcsdn/article/details/47952895


This article I have ever seen, dynamic segmentation, it is a word, but not as well, are you tested?

CodePudding user response:

Refer to
 
//CDlgSplitDlg message handlers
# define DYN

BOOL CDlgSplitDlg: : OnInitDialog ()
{
CDialog: : OnInitDialog ();
//Because the CFrameWnd needs a window class
//Create the frame window with "this" as the parent
CRect rc;
GetDlgItem (IDC_CUTSOM_WINDOW) - & gt; GetWindowRect (& amp; Rc);
The ScreenToClient (& amp; Rc);
Int the Wid=rc. Width ()/2;
Int Hei=rc. Height ()/2;
//
M_pMyFrame=new CFrameWnd;
M_pMyFrame - & gt; Create (" # 32770 "dialog/* */," ", WS_CHILD, rc, this);
//m_pMyFrame - & gt; MoveWindow (& amp; Rc);
//Initialize a context for the view.
CCreateContext cc.
Cc. M_pNewViewClass=RUNTIME_CLASS (CMyView);
Cc. M_pCurrentFrame=m_pMyFrame;
Cc. M_pCurrentDoc=NULL;
Cc. M_pNewDocTemplate=NULL;
Cc. M_pLastView=NULL;
//Get the rectangle of the custom window. The custom window
//is just a big a button that is not visible and is disabled.
//It 's a was catnip to not use coordinates directly.
//create the splitter with the frame as the parent
# ifdef _DEBUG
AfxTraceEnabled=FALSE;
# endif
# ifdef DYN
M_Splitter. Create (m_pMyFrame, 2, 2, CSize (50, 50), & amp; Cc, WS_CAPTION | WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT);
//after created this is no use:
//m_Splitter. ModifyStyle (WS_HSCROLL | WS_VSCROLL, 0).
M_Splitter. MoveWindow (0, 0, rc Width (), rc, Height ());
M_Splitter. SplitRow (Hei);
M_Splitter. SplitColumn (Wid);
# the else
M_Splitter. CreateStatic (m_pMyFrame, 2, 2);//
//create views
M_Splitter. CreateView (0, 0, RUNTIME_CLASS (CMyView), CSize (Wid, Hei), & amp; Cc);
M_Splitter. CreateView (0, 1, RUNTIME_CLASS (CMyView), CSize (Wid, Hei), & amp; Cc);
M_Splitter. CreateView (1, 0, RUNTIME_CLASS (CMyView), CSize (Wid, Hei), & amp; Cc);
M_Splitter. CreateView (1, 1, RUNTIME_CLASS (CMyView), CSize (Wid, Hei), & amp; Cc);
M_Splitter. MoveWindow (0, 0, rc Width (), rc, Height ());
# endif
# ifdef _DEBUG
AfxTraceEnabled=TRUE;
# endif
M_pMyFrame - & gt; ShowWindow (SW_SHOW);
M_Splitter. ShowWindow (SW_SHOW);
//
((CMyView *) m_Splitter GetPane (0, 0)) - & gt; OnInitialUpdate ();
((CMyView *) m_Splitter GetPane (0, 1)) - & gt; OnInitialUpdate ();
((CMyView *) m_Splitter GetPane (1, 0)) - & gt; OnInitialUpdate ();
((CMyView *) m_Splitter GetPane (1, 1)) - & gt; OnInitialUpdate ();
//
//SetTimer (1100, 00, 0);
return TRUE;//return TRUE unless you set the focus to a control
//the EXCEPTION: OCX Property Pages should return
//FALSE
}

CodePudding user response:

Refer to the MSDN documentation CCreateContext
  • Related