How to delete vertical scrollbar

  • Thread starter Thread starter japanisapig
  • Start date Start date
J

japanisapig

Guest
I build a project on the base of MFCs CFormView, and construct a dialog based on CFormView. when exe is executed,the child dialog show on the view(mainframe),now I want to delete the vertical scrollbar(child dialogs height is shorter than frame window),code as below:

void CTemp1View::OnSize(UINT nType, int cx, int cy) //this function is not executed{
CFormView::OnSize(nType, cx, cy);

// TODO: Add your message handler code here
ModifyStyle(WS_VSCROLL, 0);
}

void CTemp1View::OnInitialUpdate()//this function is not executed
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
ModifyStyle(WS_VSCROLL, 0);
}


BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VSCROLL | WS_THICKFRAME);
return TRUE;
}

void CChildDlg::OnInitialUpdate() /* child dialog */
{
CFormView::OnInitialUpdate();

// TODO: Add your specialized code here and/or call the base class
//function below is not executed,but vertical scrollbar is exist
ModifyStyle(WS_VSCROLL,0);
}


BOOL CChildDlg::OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll) /*scrollbar message function*/
{
// TODO: Add your specialized code here and/or call the base class

return CFormView::OnScroll(nScrollCode, nPos, bDoScroll);
}


what should I do?

Continue reading...
 
Back
Top