code\DB31470View.cpp(107) : warning C4244: '*=' : conversion from 'const double' to 'long', possible loss of data
程序显示这样一个警告,可我不知该怎么改,原程序如下:
void CDB31470View::DoDraw(CDC *pDC, CRect rec, CPlantDoc *pDoc)
{
pDC->FillSolidRect(rec,RGB(255,255,255));
pDC->SetBkColor(pDoc->GetPageColor());
pDC->SetMapMode(MM_TEXT);
CFont *oldFont,newFont;
LOGFONT logFont;
oldFont = pDC->GetCurrentFont();
oldFont->GetLogFont(&logFont);
logFont.lfHeight *= 1.3;
logFont.lfWidth = logFont.lfHeight/2;
sprintf(logFont.lfFaceName,"Times New Romas");
程序显示这样一个警告,可我不知该怎么改,原程序如下:
void CDB31470View::DoDraw(CDC *pDC, CRect rec, CPlantDoc *pDoc)
{
pDC->FillSolidRect(rec,RGB(255,255,255));
pDC->SetBkColor(pDoc->GetPageColor());
pDC->SetMapMode(MM_TEXT);
CFont *oldFont,newFont;
LOGFONT logFont;
oldFont = pDC->GetCurrentFont();
oldFont->GetLogFont(&logFont);
logFont.lfHeight *= 1.3;
logFont.lfWidth = logFont.lfHeight/2;
sprintf(logFont.lfFaceName,"Times New Romas");
好像在你的这一句中logFont.lfHeight *= 1.3;
logFont.lfHeight 是整型,1.3是双精度型,把1.3改为整形数据即可
数据类型的问题
转化成整型,或者强制转换。