1
DlgProc
의 WM_INITDIALOG
메시지에있는 (라디오 버튼) 컨트롤의 컨트롤 (내가 무엇이라고 생각 하는가)을 결정하는 데 문제가 있습니다.WM_INITDIALOG 메시지의 컨트롤 좌표는 어떻게 결정합니까?
는 여기에 내가 시도 내용은 다음과 같습니다
// Retrieve coordinates of Control with respect to the screen.
RECT rectOrthoButton;
GetWindowRect(GetDlgItem(hWnd, IDC_ORTHO), &rectOrthoButton);
// Translate coordinates to more useful coordinates: those that
// are used on the dialog.
// In order to do the translation we have to find the top left
// point (coordinates) of the dialog's client:
POINT dlgTopLeft;
ClientToScreen(hWnd, &dlgTopLeft);
// With these coordinates we can do the translation.
// We're only interested in top and left, so we skip
// bottom and right:
rectOrthoButton.top -= dlgTopLeft.y;
rectOrthoButton.left -= dlgTopLeft.x;
use_top_and_left(rectOrthoButton.top, rectOrthoButton.left);
나는 대화 상자의 클라이언트 영역에 대한 내 컨트롤
의 왼쪽 상단의 좌표가 될 rectOrthoButton.top
및 .left
을 예상했다. 그들은 그렇지 않은 것으로 밝혀졌고 확실하지 않습니다. 그들이 가리키는 내용은 rectOrthoButton.left
이고 -40과 같습니다.
편집 : 지금은 (내가 바보 잊었 )
POINT dlgTopLeft = {0, 0};
로 포인트 초기화하도록 지시 한 것을 : 내가 원하는 것을 달성하기 위해 짧은 방법이 있나요를?
ClientToScreen을 호출하기 전에 dlgTopLeft.x/y에 '0'을 넣지 않으시겠습니까? –
예, 그랬습니다! 이제, 당신이 대답을했다면 나는 당신의 답을 똑같이 틱 할 수 있습니다. 어쨌든 고마워. –