sparafucile17
Programmer
Does anyone know how to calculate the number of twips per pixel? I am trying to determine how many lines of text will fit into my Rich Edit box. I can physically count that there are 23 lines at *MY* default windows font, but what I want to do is to figure out how to calculate this. So this is what I have so far:
CRichEditCtrl m_LogCtrl;
CHARFORMAT f;
RECT LogRect;
m_LogCtrl.GetDefaultCharFormat(f);
m_LogCtrl.GetRect(&LogRect);
LinesInLog = (LogRect.bottom - LogRect.top) / (f.yHeight);
The problem comes in when I try to determione the height of the font in pixels... The variable f.yHeight is returned in twips. But I can't for the life of me figure out how to get that into pixels.
Any suggestions and/or other alternatives for finding the max number of lines of text in a Rich Edit box?
Thanks,
Jeff Tackett
Sofware Engineer
Visteon Corp.
CRichEditCtrl m_LogCtrl;
CHARFORMAT f;
RECT LogRect;
m_LogCtrl.GetDefaultCharFormat(f);
m_LogCtrl.GetRect(&LogRect);
LinesInLog = (LogRect.bottom - LogRect.top) / (f.yHeight);
The problem comes in when I try to determione the height of the font in pixels... The variable f.yHeight is returned in twips. But I can't for the life of me figure out how to get that into pixels.
Any suggestions and/or other alternatives for finding the max number of lines of text in a Rich Edit box?
Thanks,
Jeff Tackett
Sofware Engineer
Visteon Corp.