代码:void CFiveView::OnDraw(CDC* pDC)
{
CFiveDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//Determine the size of the window. CRect rcClient; GetClientRect (rcClient); //Create sample string. CString str (_T ("Wheeee...I am rotating!")); //Draw transparent, red text. pDC->SetBkMode (TRANSPARENT); pDC->SetTextColor (RGB (255,0,0)); CFont font; //font object LOGFONT stFont; //font definition //Set font attributes that will not change. memset (&stFont, 0, sizeof (LOGFONT)); stFont.ifheight=MulDiv (14, -pDC->GetDeviceCaps (LOGPIXELSY), 72); stFont.ifWeight=FW_NORMAL; stFont.ifClipPrecision=LCIP_LH_ANGLES; strcpy (stFont.lfFaceName, "Arial"); //Draw text at 15degree intervals. for (int nAngle=0; nAngle<3600; nAngle+=150) { //Specify new angle. stFont.lfEscapement=nAngle; //Create and select font into dc. font.CreateFontIndirect (&stfont); CFont* pOldFont=pDC->SelectObject (&font); //Draw the text. pDC->SelectObject (pOldFont); font.DelectObjext (); } 
// TODO: add draw code for native data here

错误:D:\vs\MSDev98\MyProjects\five\fiveView.cpp(87) : error C2039: 'ifheight' : is not a member of 'tagLOGFONTA'
        d:\microsoft visual studio\vc98\include\wingdi.h(1073) : see declaration of 'tagLOGFONTA'
D:\vs\MSDev98\MyProjects\five\fiveView.cpp(89) : error C2039: 'ifWeight' : is not a member of 'tagLOGFONTA'
        d:\microsoft visual studio\vc98\include\wingdi.h(1073) : see declaration of 'tagLOGFONTA'
D:\vs\MSDev98\MyProjects\five\fiveView.cpp(91) : error C2039: 'ifClipPrecision' : is not a member of 'tagLOGFONTA'
        d:\microsoft visual studio\vc98\include\wingdi.h(1073) : see declaration of 'tagLOGFONTA'
D:\vs\MSDev98\MyProjects\five\fiveView.cpp(91) : error C2065: 'LCIP_LH_ANGLES' : undeclared identifier
D:\vs\MSDev98\MyProjects\five\fiveView.cpp(107) : error C2065: 'stfont' : undeclared identifier
D:\vs\MSDev98\MyProjects\five\fiveView.cpp(115) : error C2039: 'DelectObjext' : is not a member of 'CFont'
        d:\microsoft visual studio\vc98\mfc\include\afxwin.h(494) : see declaration of 'CFont'
Error executing cl.exe.我需要加入什么.h文件???

解决方案 »

  1.   

    lfWeight
    DeleteObject
    stFont
    看一下logFont结构就明白了.
      

  2.   

    wingdi.h这个我一早就加上了!
      

  3.   

    加入wingdi.h
    另外
    stFont.ifheight=MulDiv (14, -pDC->GetDeviceCaps (LOGPIXELSY), 72); stFont.ifWeight=FW_NORMAL; stFont.ifClipPrecision=LCIP_LH_ANGLES; 这几行stFont后面是lfheight,不是ifheight......
      

  4.   

    改成lfheight的错误:
    D:\vs\MSDev98\MyProjects\five\fiveView.cpp(87) : error C2039: 'lfheight' : is not a member of 'tagLOGFONTA'
            d:\microsoft visual studio\vc98\include\wingdi.h(1073) : see declaration of 'tagLOGFONTA'
    D:\vs\MSDev98\MyProjects\five\fiveView.cpp(91) : error C2065: 'LCIP_LH_ANGLES' : undeclared identifier
    D:\vs\MSDev98\MyProjects\five\fiveView.cpp(107) : error C2065: 'stfont' : undeclared identifier
    D:\vs\MSDev98\MyProjects\five\fiveView.cpp(115) : error C2039: 'DelectObjext' : is not a member of 'CFont'
            d:\microsoft visual studio\vc98\mfc\include\afxwin.h(494) : see declaration of 'CFont'
    我已经声明:
    #include "stdafx.h"
    #include "five.h"
    #include "wingdi.h"
    #include "fiveDoc.h"
    #include "fiveView.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
      

  5.   

    你好想写错了,应该是ifHeight,不是ifheight。
      

  6.   

    你太大意思了,全是拼写错误,我修改了如下 CRect rcClient;  GetClientRect (rcClient);  //Create sample string.  CString str (_T ("Wheeee...I am rotating!"));  //Draw transparent, red text.  pDC->SetBkMode (TRANSPARENT);  pDC->SetTextColor (RGB (255,0,0));  CFont font; //font object  LOGFONT stFont; //font definition  //Set font attributes that will not change.  memset (&stFont, 0, sizeof (LOGFONT));  stFont.lfHeight=MulDiv (14, -pDC->GetDeviceCaps (LOGPIXELSY), 72);  stFont.lfWeight=FW_NORMAL;  stFont.lfClipPrecision = CLIP_LH_ANGLES;  strcpy (stFont.lfFaceName, "Arial");  //Draw text at 15degree intervals.  for (int nAngle=0; nAngle<3600; nAngle+=150) 
    {  //Specify new angle.  stFont.lfEscapement=nAngle;  //Create and select font into dc.  font.CreateFontIndirect (&stFont);  CFont* pOldFont=pDC->SelectObject (&font);  //Draw the text.  pDC->SelectObject (pOldFont);  font.DeleteObject(); 
    }
      

  7.   

    没装上MSDN加上我新学两周!买了几张MSDN都装不上,倒霉吧!!