MFC设置窗口大小、位置


1  SetWindowPos(NULL,0,0,200,300,SWP_NOMOVE); 
2 
3 //  表示不考虑(0,0),仅仅将大小改为200x300,位置不变  
4 //  SetWindowPos(NULL,0,0,200,300,SWP_NOMOVE);  
5 //  表示不考虑200X300,只是把位置挪到(0,0).大小不变  
6 //  如果想同时改变,最后可用SWP_NOZORDER等  
7 //  参数中还有SWP_SHOWWINDOW   显示窗口   对应的SWP_HIDEWINDOW  

 

1 //在OnShowWindow函数中完成窗口居中。
2 
3 //共三种方法:
4 CenterWindow( ); //Relative to it's parent
5 
6 CenterWindow(CWnd:: GetDesktopWindow( )); // Relative to Screen
7 
8 AfxGetMainWnd( ) -> Center Window( ); //Relative to Application's MainWindow

 

 

 
posted @ 2014-03-23 17:46  风一兮  阅读(7264)  评论(0编辑  收藏  举报