Device context and dimensions
-
Hello, I came across something i don't understand one little bit, and i hope you can help me understand it. The code is in the function OnDraw with parameter CDC* pDC and i have the following code
rectPreviewClient.SetRect(0, 0, pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
...
CDC dc;
dc.Attach(pDC->GetSafeHdc());And the CRect rectPreviewClientis given to a function which draws some stuff. The map mode isn't changed and it remains MM_ANISOTROPIC even until the drawing of the elements. The thing i don't understand is how come i can print stuff for example
dc.TextOut(0, rectPreviewClient.bottom - tm.tmHeight,....)
//tm is from type TEXTMETRIC taken with GetTextMetrics() from dcwhen its clear the both CDC members have different dimensions. The dpi's are different pDC have 600 dpi and dc has 96. If i use GetDeviceCaps(HORZRES) and GetDeviceCaps(VERTRES)on dc i get smaller numbers and yet i can print stuff with a lot higher coordinates. Note: The dc is used for PrintPreview. Currently i am trying to change the font size and i need to change the map mode to MM_TEXT but when i call TextOut with the coordinates normally used the text is drown outside the CDC. If the MM_TEXT is removed the text is shown but too small Edit: I fixed the Font size without changing the map mode with CreatePointFont and height of the Font size but the question remains How can i use coordinates from one CDC to another with different dpi and dimensions. Any help will be appreciated. Thank you in advance.
Microsoft ... the only place where VARIANT_TRUE != true