MFC运行初始如何对话框就能出现在右边位置(而不是居中)??
1条回答 默认 最新
gdhk189 2018-02-10 03:51关注// 对话框靠右
ShowWindow(SW_NORMAL);
CRect rtDesk;
CRect rtDlg;
::GetWindowRect(::GetDesktopWindow(), &rtDesk);
GetWindowRect(&rtDlg);
int iXpos = rtDesk.Width() - rtDlg.Width();
int iYpos = rtDesk.Height() / 2 - rtDlg.Height() / 2;
SetWindowPos(NULL, iXpos, iYpos, 0, 0, SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER);本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报