RECT rect,rc;
this ->GetWindowRect(&rc);
m_add.GetWindowRect(&rect);
rect.bottom=rect.bottom-rc.top;
rect.left=rect.left-rc.left;
rect.top=rect.top-rc.top;
rect.right=rect.right-rc.left;
while(point.x>rect.left&&point.x<rect.right&&point.y>rect.top&&point.y<rect.bottom)
{
AfxMessageBox("test");
}
自己是这么写的,获取出来的按钮坐标left 和right是对的,但是top和bottom无论如何都不对,我也试过用ScreenToClient(rect),提示错误 error C2664
MFC中如何获取按钮的坐标
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- threenewbee 2016-05-13 03:09关注
ScreenToClient(rect)是可以的,你那个编译错误,贴出具体的代码看下。
http://blog.chinaunix.net/uid-14607221-id-2794661.html解决 无用评论 打赏 举报