BOOL CViewDlgDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rectWindow;
GetWindowRect(rectWindow);
CRuntimeClass *pViewClass = RUNTIME_CLASS(CMyScrollView);
CCreateContext * pContext;
pContext = new CCreateContext;
pContext->m_pCurrentDoc = NULL;
pContext->m_pCurrentFrame = NULL;
pContext->m_pLastView = NULL;
pContext->m_pNewDocTemplate =NULL;
pContext->m_pNewViewClass = pViewClass;
CWnd * pWnd = NULL;
pWnd = DYNAMIC_DOWNCAST(CWnd,pViewClass->CreateObject()); pWnd->reate(NULL,NULL,AFX_WS_DEFAULT_VIEW,CRect(0,0,0,0),this,0,pContext);
delete pContext;
CMyScrollView * pScollView = DYNAMIC_DOWNCAST(CMyScrollView,pWnd);
pScollView->SetScrollSizes( MM_TEXT, CSize(rectWindow.right - rectWindow.left-20, rectWindow.bottom -rectWindow.top-100) );
pScollView->MoveWindow(rectWindow.left,rectWindow.top,rectWindow.right - rectWindow.left-20, rectWindow.bottom -rectWindow.top-100,TRUE);
return true;
}
在对话框中使用CSrollView
最新推荐文章于 2021-05-17 15:29:27 发布