Confusion in the two functions of MFC GDI

and a good day for all of you. This is my first post here. I read "Windows Programming with MFC-J Prosise (MS Press)"
In the second chapter, I came across two GDI functions that really confused me, I quote the text:

It's easy to get SetViewportOrg and SetWindowOrg to get confused, but the difference between them is actually quite clear. Changing the view source in (x, y) using SetViewportOrg tells Windows to map the logical point (0,0) to the device point (x, y). Changing the start of the window to (x, y) using SetWindowOrg does essentially the opposite, telling Windows to map the logical point (x, y) to the device point (0,0) - the upper left corner of the display surface. In the MM_TEXT display mode, the only real difference between the two functions is the signs x and y. In other display modes there is more than because SetViewportOrg concludes deals in device coordinates, and SetWindowOrg operations in logical coordinates

I am really confused by this, it looks like if we change the beginning of the point of view to say (50.50) and then use dc.ellipse (0,0,50,50), it will start from the point of the device (50, 50) as the source, but if we changed the beginning of the window to (50.50), this means that now the logical point (50.50) will be displayed on (0,0), if so, will the ellipse be absent from customer area in the upper area? And what display mode was MM_LOWENGLISH or something else? How will the situation change? Please, if anyone can shed light on this question, I would be very grateful

+5
source share
1 answer

, , ( ). Windows , .

SetWindowOrg . , .

SetViewportOrg , , - , , . , , . - :

CRect rect;
GetClientRect(&rect);

pDC->SetViewportOrg(0, rect.Height());

OTOH, , , , x = 0 , y = 0, . - :

// get rect as above.
pDC->SetViewportOrg(0, rect.Height()/2);

, (0,0), :

// again, get rect like above
pDC->SetViewportOrg(rect.Width()/2, rect.Height()/2);

, - , MM_ISOTROPIC MM_ANISOTROPIC - , . [MM_TEXT MM_ (LO | HI) (ENGLISH | METRIC)] .

+6

All Articles