user13267
user13267

Reputation: 7193

Changing position of origin inside a window's Client area to get cursor position

The SetViewPortOrg() function changes the origin of the viewport so that I can start drawing graphics using this new origin
Is it possible to similarly change the origin for getting the cursor position? For example, I want to get the position of my cursor relative to my viewport's origin. Are there any built in functions to do this? Or do I have to make my own function manipulating the GetCursorPos() and ScreenToClient() functions?

Upvotes: 0

Views: 317

Answers (1)

ScottMcP-MVP
ScottMcP-MVP

Reputation: 10425

The DPtoLP function converts device coordinates into logical coordinates. The conversion depends on the mapping mode of the device context, the settings of the origins and extents for the window and viewport, and the world transformation.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162474(v=vs.85).aspx

Upvotes: 1

Related Questions