pDC->SetMapMode(MM_HIMETRIC);
pDC->SetTextCharacterExtra(85);
CFont* def_font = pDC->SelectObject(&font);
CRect r;
CString strName="1884-1922"; //does not print '-'
r.SetRect(200,-2000,8000,-3000);
pDC->DrawText(strName,r,DT_CENTER);
strName="ABCDEFG";
r.SetRect(200,-3000,8000,-4000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1884X1922";//the X gets printed over the 4
r.SetRect(200,-4000,8000,-5000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1884 1922";
r.SetRect(200,-5000,8000,-6000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1a2b3c1A2B3C4X";
r.SetRect(200,-6000,8000,-7000);
pDC->DrawText(strName,r,DT_CENTER);
Do you have enough space for the text? For MM_HIMETRIC mode a
logical unit equals to 0.01 mm. You give 7800 logical units for
the text string, it is 78 mm. This is pretty much space, but
didn't say what the size of a font.
HTH
Alex
Thank ,
Tim
This functionality is too basic in order to ascribe the problem to
a display driver bug. Of course, everything is possible, but as a
first step I'd suggest you to reproduce the problem with minimal
standalone application.
Alex
void CNewView::OnDraw(CDC* pDC)
{
pDC->SetMapMode(MM_HIMETRIC);
pDC->SetTextCharacterExtra(85);
CRect r;
CString strName="1884-1922"; //does not print '-'
r.SetRect(200,-2000,8000,-3000);
pDC->DrawText(strName,r,DT_CENTER);
strName="ABCDEFG";
r.SetRect(200,-3000,8000,-4000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1884X1922";//the X gets printed over the 4
r.SetRect(200,-4000,8000,-5000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1884 1922";
r.SetRect(200,-5000,8000,-6000);
pDC->DrawText(strName,r,DT_CENTER);
strName="1a2b3c1A2B3C4X";
r.SetRect(200,-6000,8000,-7000);
pDC->DrawText(strName,r,DT_CENTER);
}
Thank you,
Tim
I succeeded to reproduce it on my system, too. I don't know what
exactly causes the problem, but these changes apparently fix it:
> void CNewView::OnDraw(CDC* pDC)
> {
> pDC->SetMapMode(MM_HIMETRIC);
> pDC->SetTextCharacterExtra(85);
pDC->SetTextAlign(TA_CENTER);
> CRect r;
>
> CString strName="1884-1922"; //does not print '-'
> r.SetRect(200,-2000,8000,-3000);
pDC->ExtTextOut(r.CenterPoint().x, r.top, 0, r, strName, NULL);
...
HTH
Alex
Thanks again,
Tim
"Alex Blekhman" wrote:
> ....
>
> HTH
> Alex
>
>
>