VC ScreenToClient与ClientToScreen
来源:互联网 发布:http端口号 修改 编辑:程序博客网 时间:2024/06/06 00:23
The ClientToScreen function replaces theclient-area coordinates in the POINT structure with the screen coordinates. The screen coordinates are relative to the upper-left corner of the screen. Note, a screen-coordinate point that is above the window's client area has a negative y-coordinate. Similarly, a screen coordinate to the left of a client area has a negative x-coordinate.
The ScreenToClient member function replaces the screen coordinates given in lpPoint or lpRect with client coordinates. The new coordinates are relative to the upper-left corner of the CWnd client area.
实际就是一个屏幕坐标,一个客户区坐标,这两个坐标系统的转换
GetWindowRect得到的是screen coordinates. GetClientRect得到的是client-area coordinates,所以GetClientRect得到的总是以(0,0)为左上的点。
The dimensions are given in screen coordinates relative to the upper-left corner of thedisplay screen. The dimensions of the caption, border, and scroll bars, if present, are included.
如果我们要获取一个窗口pWnd相对于父窗口parent客户区的位置应该是:
Rect rc;
pWnd->GetWindowRect(&rc);
parent->ScreenToClient(&rc);
如果如下:
pWnd->GetWindowRect(&rc);
pWnd->ScreenToClient(&rc);
得到的rc左顶坐标会出项负数,因为将自己的窗口往客户区映射,会出现标题栏/边框等的位置差错。
- VC ScreenToClient与ClientToScreen
- GetWindowRect、GetClientRect、ScreenToClient与ClientToScreen
- GetWindowRect、GetClientRect、ScreenToClient与ClientToScreen
- GetWindowRect、GetClientRect、ScreenToClient与ClientToScreen
- ClientToScreen( )与ScreenToClient( )的区别
- VC++中的GetWindowRect,GetClientRect,ScreenToClient , ClientToScreen();
- 坐标的相对转换ClientToScreen与ScreenToClient
- ClientToScreen 和ScreenToClient
- GetWindowRect、GetClientRect、ClientToScreen、ScreenToClient
- ClientToScreen 和 ScreenToClient
- ClientToScreen 和ScreenToClient
- Popup&ScreenToClient&ClientToScreen
- ClientToScreen 和ScreenToClient
- ClientToScreen 和 ScreenToClient
- ClientToScreen 和ScreenToClient 用法
- MFC ClientToScreen 和 ScreenToClient
- ClientToScreen ScreenToClient GetWindowRect GetClientRect
- ClientToScreen 和ScreenToClient 用法
- linux 防火墙添加对外开放端口
- Sublime Text 3 调教你的私人利器
- 日常(夏日装扮。。。)
- centos 安装配置 snmp
- SpringBoot文件上传大小设置问题
- VC ScreenToClient与ClientToScreen
- UVA
- list遍历的方法
- 关于SQL中的字段“包含”与“包含于”字符串的写法
- 从零开始学 Java
- 摘抄---USB RNDIS/CDC White Paper January 15, 2003
- VS2013出现未能正确加载 microsoft.visualstudio.editor.implementation.editorpackage的解决方法
- Jmete
- .NET中的反射(3)