这个问题困扰我很久了。
我一直找不到办法解决!
靠大家了!

解决方案 »

  1.   

    SIZE FontSize; //得到的汉字大小CDC * pDC = GetDC();
    m_fOldFont = pDC->SelectObject( &m_fFont );
    GetTextExtentPoint32( pDC->m_hDC, "字", 2, &FontSize );
    pDC->SelectObject( pFace->m_fOldFont );
    ReleaseDC( pDC );FontSize.cx; //汉字宽度
      

  2.   


    同意。
    还有一个api函数可以用,这个函数求一个内码范围内的字宽比较有效
    BOOL GetCharWidth32(
      HDC hdc,          // handle to DC
      UINT iFirstChar,  // first character in range
      UINT iLastChar,   // last character in range
      LPINT lpBuffer    // buffer for widths
    );
      

  3.   

    SIZE Size; 
    CDC dc;
    dc.CreateCompatableDC(NULL);
    dc.GetOutputTextExtent( );  //具体调用格式 MSDNSize.cx; //宽度
      

  4.   

    好象是 
    Size = dc.GetOutputTextExtent("哈",2 );