我使用CSplitterWnd将视图分成了两部分,在文档类中计算数据,然后根据该数据来改变其中一个视图的大小,但是不成功,需要用鼠标改变一下框架大小之后,才响应我的设置,请问是什么原因。我用的函数是:
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndSplitter.SetRowInfo(0,m_nAreaCurveNum*35,20);
pFrame->UpdateWindow();
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndSplitter.SetRowInfo(0,m_nAreaCurveNum*35,20);
pFrame->UpdateWindow();
文档类
CPlotView* ppView;
CView* pView; POSITION pos=GetFirstViewPosition();
while(pos!=NULL)
{
pView=GetNextView(pos);
if(pView->IsKindOf(RUNTIME_CLASS(CPlotView)))
{
ppView=(CPlotView*)pView;
ppView->SendMessage(WM_SIZE,1,0);
break;
}
}
视图类OnSize函数:
if(pDoc->GetDataLoad())
{
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndSplitter.SetRowInfo(0,pDoc->m_nAreaCurveNum*35,20);
pFrame->RecalcLayout();
}
CMainFrame *pFrame=(CMainFrame *)AfxGetMainWnd();
pFrame->m_wndSplitter.SetRowInfo(0,m_nAreaCurveNum*35,20);
pFrame->ShowWindow( SW_SHOWMAXIMIZED );
pFrame->ShowWindow( SW_RESTORE );
pFrame->m_wndSplitter.RecalcLayout();
而并不是
pFrame->RecalcLayout();
pFrame->m_wndSplitter.RecalcLayout();
而并不是
pFrame->RecalcLayout();