解决方案 »

  1.   

    顶!我想居中打印文字,怎么弄呀!createFont函数中的那个width参数好象没有用嘛,怎么设打印出的效果都一样
      

  2.   

    设备上的两个点的距离:
    The GetDeviceCaps function retrieves device-specific information for the specified device. int GetDeviceCaps(
      HDC hdc,     // handle to DC
      int nIndex   // index of capability
    );width<0 时表示设备上的单位
    Value Meaning 
    > 0 The font mapper transforms this value into device units and matches it against the cell height of the available fonts. 
    0 The font mapper uses a default height value when it searches for a match. 
    < 0 The font mapper transforms this value into device units and matches its absolute value against the character height of the available fonts. 
      

  3.   

    //取当前字体大小
    CFont *curFont = pDC->GetCurrentFont();
    curFont->GetLogFont( &curLogFont );
    long NewFontWidth = curLogFont.lfWidth;//宽
    long NewFontHeight = curLogFont.lfHeight;//高
      

  4.   

    呵呵,谢了哈!搞定,用pDC->GetTextExtent("aaaaa");就可以获得使用当前字体打印时字符串占用的CSize对象