想将一个字符串中的每个字符逆时针90度旋转(即文字是逆时针躺着放的),如何使用GDI+来实现。高手指点。

解决方案 »

  1.   


    CFont m_font; VERIFY(m_font.CreateFont(   
            36,                                                 //   nHeight   
            0,                                                   //   nWidth   
            900, //90 * 10                            //   nEscapement   
            0,                                                   //   nOrientation   
            FW_NORMAL,                                   //   nWeight   
            FALSE,                                           //   bItalic   
            FALSE,                                           //   bUnderline   
            0,                                                   //   cStrikeOut   
            ANSI_CHARSET,                             //   nCharSet   
            OUT_DEFAULT_PRECIS,                 //   nOutPrecision   
            CLIP_DEFAULT_PRECIS,               //   nClipPrecision   
            DEFAULT_QUALITY,                       //   nQuality   
            DEFAULT_PITCH   |   FF_SWISS,     //   nPitchAndFamily   
            "Arial"));                                   //   lpszFacename   ////////////////////////////// CFont *oldFont = pDC->SelectObject(&m_font);
    pDC->TextOut(100,100,"Devang");
    pDC->SelectObject(oldFont);
    //////////////////////////////
    m_font.DeleteObject();
      

  2.   

    也可在LOGFONT结构的lfEscapement和lfOrientation字段指定与期望的旋转角度成10倍的数.然后用CFont::CreateFontIndirect()或CFont::CreatePointFontIndirect()创建字体.然后正常方法显示字符就行了
      

  3.   

    ls没看清我的题目,我是想用GDI+来实现。我现在大致已经实现。代码如下:
    graphics.TranslateTransform(origin.X,origin.Y);
    graphics.RotateTransform(-90);
    StringFormat format;
    format.SetFormatFlags( StringFormatFlagsDirectionVertical)
    graphics.DrawString(wch_UnicodeString,wcslen(wch_UnicodeString),pFont,origin,&format,t);
    这里的orgin是不同字符串(wch_UnicodeString)的原点,但是现在存在一个问题,就是字符串旋转之后偏离的较多。
    哪位能介绍一下TranslateTransform是如何旋转的,以什么为原点的。选择之后的字符串的origin应该如何设置。