Discussion:
SetMapMode question
(too old to reply)
Jack
2010-01-10 11:34:15 UTC
Permalink
Hi guys,
I am trying to use the SetMapMode(...) API to
place the origin at the lower-left of the client of the window.
So that positive x to the right and +ve y up
I've tried MM_TWIPS, MM_LOMETRIC
and MM_HIMETRIC etc, just to name a few
But the bitmap I rendered disappeared.
I learned in MSDN that the logical unit in these calls
range from 0.001 inch to 0.01 mill etc respectively, but
I am not sure if this is the root cause of the problem (disappearance of the
image)..
Do I need to call one of the functions namely
SetWindowExt or something? What is the correct
coding in this case? Could anyone please show me some
code snippets? It will be greatly appreciated!!
Thanks
Jack
Igor Tandetnik
2010-01-10 15:59:56 UTC
Permalink
Post by Jack
Hi guys,
I am trying to use the SetMapMode(...) API to
place the origin at the lower-left of the client of the window.
So that positive x to the right and +ve y up
I've tried MM_TWIPS, MM_LOMETRIC
and MM_HIMETRIC etc, just to name a few
But the bitmap I rendered disappeared.
With these modes, Y axis goes up but the origin is still in the top left corner. So the visible area is at negative Y coordinates. You are likely drawing your bitmap offscreen.

To change the origin, use SetViewportOrgEx / SetWindowOrgExt.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925
Jack
2010-01-11 07:58:18 UTC
Permalink
Thanks Igor, I might have overlooked that one.
Let me take a look at those APIs....
Jack
Jack
2010-01-11 09:37:13 UTC
Permalink
Problem solved, thanks Igor
Jack

Loading...