MFC对话框屏幕居中

Ichjns

关注

阅读 163

2023-01-16


// 对话框屏幕居中
ShowWindow(SW_NORMAL);
CRect rtDesk;
CRect rtDlg;
::GetWindowRect(::GetDesktopWindow(), &rtDesk);
GetWindowRect(&rtDlg);
int iXpos = rtDesk.Width() / 2 - rtDlg.Width() / 2;
int iYpos = rtDesk.Height() / 2 - rtDlg.Height() / 2;
SetWindowPos(NULL, iXpos, iYpos, 0, 0, SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);





精彩评论(0)

0 0 举报