Yes, use MoveWindow or SetWindowPos.After Create or Createex, pls use Invalidate to repain control, or set the SW_SHOW parameter.For example:CMyDialog* pDialog;void CMyWnd::OnSomeAction() { //pDialog initialized to NULL in the constructor of CMyWnd class pDialog = new CMyDialog(); //Check if new succeeded and we got a valid pointer to a dialog object if(pDialog != NULL) { BOOL ret = pDialog->Create(IDD_MYDIALOG,this); if(!ret) //Create failed. AfxMessageBox("Error creating Dialog"); pDialog->ShowWindow(SW_SHOW); } else AfxMessageBox("Error Creating Dialog Object"); }
view类的改变了大小后(rect.right*2,rect.bottom*2,超过了clientrect),没有显示出scroll,我要求它超出clientrect后显现滚动条 how to do it?
// Get the size of the window .
Crect reWindow
GetWindowRect (reWindow )
//Make the window twice as wide and twice as tall .
SetWindowPos (NULL , 0 , 0 , reWindow . Width ( ) *2,
reWindow . Height () * 2,
SWP_NOMOVE |SWP_NOZORDER )
为什么create和createx重新创建窗体在运行时什么也没看见?
Create之后要执行ShowWindow(SW_SHOW)
它不仅可以改变窗口的大小,还可以改变窗口的位置
or set the SW_SHOW parameter.For example:CMyDialog* pDialog;void CMyWnd::OnSomeAction()
{
//pDialog initialized to NULL in the constructor of CMyWnd class
pDialog = new CMyDialog();
//Check if new succeeded and we got a valid pointer to a dialog object
if(pDialog != NULL)
{
BOOL ret = pDialog->Create(IDD_MYDIALOG,this);
if(!ret) //Create failed.
AfxMessageBox("Error creating Dialog");
pDialog->ShowWindow(SW_SHOW);
}
else
AfxMessageBox("Error Creating Dialog Object");
}
how to do it?