VC/MFC 固定窗口大小、居中显示
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs){ if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT ..
·
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style=WS_OVERLAPPED | WS_SYSMENU |WS_MINIMIZEBOX ; //去除窗口拖拉、最大化属性
cs.cx=950; //设定窗口宽度
cs.cy=720; //设定窗口高度
return TRUE;
}
2、让窗口居中显示
在窗口初始化函数,如OnInitDialog() (对话框),OnCreate()(多文档)中添加下面的代码:
CenterWindow();
更多推荐
所有评论(0)