0
我遇到这样的代码:屏幕坐标和设备坐标有什么区别?
//handler for context menu element; to move an element
void CRTS_SketcherView::OnElementMove()
{
CClientDC aDC(this);
OnPrepareDC(&aDC); //Set up the device context
GetCursorPos(&m_CursorPos); //Get cursor position in screen coords
ScreenToClient(&m_CursorPos); //convert to client coords
aDC.DPtoLP(&m_CursorPos); //Convert to logical
// ...code to initialize the moving of a shape on screen
}
我知道光标是屏幕坐标是它在屏幕上的位置,和客户端坐标是窗口的客户区坐标不管位置窗口。 但是什么是设备坐标?我唯一知道的是它们是以像素为单位的,但它们如何连接到逻辑(客户端)和屏幕坐标?
该言论还表示,我们首先将坐标从屏幕转换为客户端,然后从客户端坐标转换为逻辑。但是不是逻辑坐标和客户坐标相同吗? – Ghost 2012-07-27 12:29:59