请问怎样将文字以任意角度显示?

解决方案 »

  1.   

    void CSampleView:: OnDraw (CDC* pDC) 

        //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 (); 
        } 
      

  2.   

    HFONT CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCTSTR lpszFace);
    中nOrientation就是旋转角度。以水平为0度,逆时针