如何获得窗口客户区的坐标 [英] How to get coordinates of window client area

查看:180
本文介绍了如何获得窗口客户区的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能得到一个窗口整个区域的坐标,并使用GetClientRect客户区的坐标和GetWindowRect Win32调用。我的问题是,GetClientRect总是返回0,0的左上角。我如何找出实际的客户端区域是相对于窗口RECT?

I can get the coordinates of a windows entire area, and the coordinates of the client area using the GetClientRect and GetWindowRect Win32 calls. My problem is that the GetClientRect always returns 0,0 for the top left. How do I figure out what the actual client region is relative to the window rect?

推荐答案

您可以使用的ClientToScreen 拿到左上角(0,0)的坐标点在屏幕坐标。由GetClientRect返回的RECT会适当让你右下角(刚加入由ClientToScreen设置点)。

You can use ClientToScreen to get the coordinates of the upper left (0,0) point in screen coordinates. The RECT returned by GetClientRect will be appropriate to get you the lower right corner (just add to the POINT set by ClientToScreen).

这篇关于如何获得窗口客户区的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆