CDC::DrawText( ) returns strange heights??
Posted on 1998-08-02
I'm trying to use CDC::DrawText( ) to output text, and it all works marvelously, except for one thing, which I can demonstrate with 4 lines of (non- Wizard) code.
Create a new MFC exe-type project, with all the defaults. Use ClassWizard to add the OnPrint() function to the view class. Use the following code as the implementation of that OnPrint() function:
CRect rcClip(0, 0, pInfo->m_rectDraw.right, 0);
pDC->DrawText("text", 4, &rcClip, DT_LEFT | DT_CALCRECT);
TRACE1(" * Height is changing: %d\n", rcClip.Height());
Build the program, run it, and go into print preview mode. Watch the output window in MSVC as you resize the window frame of the test app: the height changes between 80 and 120 or so! What is going on?? I thought DrawText( )
set rcClip using logical units, so shouldn't the same text have the same height regardless of what the size of the window is? Notice that m_rectDraw.bottom is always the same regardless of the window size... what am I missing? TIA.