Home > Software engineering >  Ask: how to hide a split window frame?
Ask: how to hide a split window frame?

Time:11-22

Using split window shows a series of graphics, the amount of the graphics for less, because the number of generated when split window must be fixed, so need less window, you need to split some window width or height are set to 0, to hide, but its borders or in, especially to split window more hidden, they frame together, very ugly, how do I hide away?

CodePudding user response:

Try to modify the window style CWnd: : ModifyStyle
PWnd - & gt; ModifyStyle (WS_BORDER, 0, SWP_FRAMECHANGED | SWP_DRAWFRAME);


CodePudding user response:

Hide the window should be able to

CodePudding user response:

I remember as if need derived CSplitWnd class, resetting its member variables as can be,

CodePudding user response:


This is the
Set the Border is ok

CodePudding user response:

Window number change, CSplitWnd again

CodePudding user response:

Example:
 
Void CMainFrame: : ChangeSplit (int rows, int cols)
{//before the delete all, save doc
CCreateContext Context;//I hate 'new'
ZeroMemory (& amp; The Context, sizeof (Context));
The Context. M_pCurrentFrame=this;
//set doc
CDocument * pDoc=m_pMainView - & gt; GetDocument ();
The Context. M_pCurrentDoc=pDoc;
The Context. M_pNewDocTemplate=pDoc - & gt; GetDocTemplate ();
//save changes for CEditView
If (pDoc - & gt; AfxMessageBox IsModified ()) (" Put your saving code here!" );
//
CRect the rect.
GetClientRect (& amp; The rect);
CSize size=the rect. The size ();
Size. The cy -=46;//the status and the toolbar
//m_pMainView will not be does, only to show the or to hide
If ((rows==0) & amp; & (cols==0))
{
If (: : IsWindow (m_wndSplitter m_hWnd)) m_wndSplitter. The DestroyWindow ();
M_pMainView - & gt; SetDlgCtrlID (AFX_IDW_PANE_FIRST);
RecalcLayout ();
M_pMainView - & gt; ShowWindow (SW_SHOW);
return;
}

Cx/=cols size.
Size. Cy/=rows;
//hide mainview
M_pMainView - & gt; SetDlgCtrlID (AFX_IDW_PANE_FIRST + 1);
M_pMainView - & gt; ShowWindow (SW_HIDE);
//delete all views in the splitter
If (: : IsWindow (m_wndSplitter m_hWnd)) m_wndSplitter. The DestroyWindow ();
//
Char * pColInfo=0;//TMP for 'delete []'
Char * pRowInfo=0;
//the following function can rewrite the to 'void Re_Initialize (void)', an derives CSplitterWnd.
//it contains all necessary steps to re_initialize a SplitterWnd.
CSplitterWnd * pSplit=& amp; M_wndSplitter;
The __asm
{
Mov ebx, pSplit;
Mov [ebx] m_nRows, 0
Mov [ebx] m_nCols, 0
//mem leak
Mov eax, dword PTR [ebx] m_pRowInfo
Mov pRowInfo, eax//get
Mov eax, dword PTR [ebx] m_pColInfo
Mov pColInfo, eax
//what we have to do
Mov dword PTR [ebx] m_pRowInfo, 0
Mov dword PTR [ebx] m_pColInfo, 0
}
//easy way to do the delete, not in the asm.
If (pRowInfo) delete [] pRowInfo;//it was a 'new' Ed out!
If (pColInfo) delete [] pColInfo;
//now re - create the rows, cols,
if(! M_wndSplitter. CreateStatic (this, rows, cols)) AfxMessageBox (" CreateStatic failed!" );
//views
For (int jj=0; Jj{
For (int kk=0; Kk{
M_wndSplitter. CreateView (jj, kk, RUNTIME_CLASS (CYaChangeSplitView), the size, & amp; The Context);
}
}
RecalcLayout ();
InitialUpdateFrame (NULL, TRUE);
}
  • Related