
MoveWindow()这个函数的作用:Changes the window's size and position.
参数有两种:BOOL MoveWindow(int x,int y,int nWidth,int nHeight,BOOL bRepaint = TRUE ) x,y为左上角顶点坐标
BOOL MoveWindow(LPCRECT lpRect,BOOL bRepaint = TRUE )
强调:哪个对象(窗体)或指向该对象的指针调用了MoveWindow(),那么就改变该对象(窗体)的大小、位置
举例如下:CMSGOPT *temp=new CMSGOPT;

temp->Create(IDD_DLG_MAIN,this);
temp->ShowWindow(SW_SHOW);
CRect rc;
temp->GetWindowRect(&rc);//注意与this->GetWindowRect(&rc);区别。movewindow
//temp->MoveWindow((1024-rc.Width())/2,0,rc.Width(),rc.Height(),1);//居中显示,改变了位置

rc.left=(1024-rc.Width())/2;
rc.right=rc.left+500;
rc.top=0;
rc.bottom=rc.top+500;
temp->MoveWindow(&rc,true);//改变了大小与位置
temp->UpdateWindow();
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-25211-1.html
试探他们的底线
美冷战思维坑了别人也害了自己