공부/c++

MFC 화면 크기 관련

Lectinua 2019. 5. 26. 19:59

전체 화면 크기 가져오기

int x = GetSystemMetrics(SM_CXVIRTUALSCREEN);

int y = GetSystemMetrics(SM_CYVIRTUALSCREEN);

 

화면 크기 지정

MoveWindow, SetWindowPos, SetWindowPlacement

차이점: http://blog.naver.com/blue7red/100041756643

 

화면 중앙에 위치시키기

CRect rect;
GetClientRect(&rect);
CPoint pos;
pos.x = GetSystemMetrics(SM_CXSCREEN) / 2.0f - rect.Width() / 2.0f;
pos.y = GetSystemMetrics(SM_CYSCREEN) / 2.0f - rect.Height() / 2.0f;
SetWindowPos(NULL, pos.x, pos.y, 0, 0, SWP_NOSIZE);

출처: http://blog.naver.com/skywood1/100209813779

 

좀 더 자세한 정보: https://master-hun.tistory.com/75