所以,我正在尝试获取我的 MFC 窗口角的 x-y 坐标...
到目前为止,这是我的绘图函数:
// TODO: add draw code for native data here
RECT rect;
GetClientRect(&rect);
// Get window coordinates
int left = rect.left;
int right = rect.right;
int bottom = rect.bottom;
int top = rect.top;
// Print them out
CString l;
l.Format(L"%d", left);
pDC->TextOutW(0, 100, L"Left: " + l, _tcslen(l)+6);
CString r;
r.Format(L"%d", right);
pDC->TextOutW(0, 130, L"Right: " + r, _tcslen(r)+7);
CString b;
b.Format(L"%d", bottom);
pDC->TextOutW(0, 160, L"Bottom: " + b, _tcslen(b)+8);
CString t;
t.Format(L"%d", top);
pDC->TextOutW(0, 190, L"Top: " + t, _tcslen(t)+5);
我的方向是否正确? 我在想我可以找到两者的中点或沿着这些线的东西....
我还需要做什么?
另外:我如何获取物理显示器角的 x-y 坐标?
最佳答案
使用 GetWindowRect函数而不是 GetClientRect功能。
您还可以查看 ScreenToClient和 ClientToScreen功能。
关于c++ - MFC 中的窗口角坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26537903/