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};
とPOINT初期化するように指示されたこと:私が欲しいものを達成するために短い方法はありますか?
ClientToScreenを呼び出す前に、dlgTopLeft.x/yに '0'を入れないでください。 –
はい、そうでした!さて、もしあなたが答えを出したら、あなたの答えに*正しい*(あるいはそのダニが付いているもの)をチェックすることができます。とにかくありがとう。 –