送高分

解决方案 »

  1.   

    或者这样说吧,我怎么知道一个edit够不够长度将一个字符串全部显示出来??
      

  2.   

    CDC *pDC = GetDC();
    CSize size1 = pDC->GetTextExtent("W");
    CSize size2 = pDC->GetTextExtent("T");
    这样可以确定它们的宽度和高度
      

  3.   

    CDC::GetTextExtent(const CString&) const;
      

  4.   

    GetTextExtentPoint32
    The GetTextExtentPoint32 function computes the width and height of the specified string of text. BOOL GetTextExtentPoint32(
      HDC hdc,           // handle to DC
      LPCTSTR lpString,  // text string
      int cbString,      // characters in string
      LPSIZE lpSize      // string size
    );
    Parameters
    hdc 
    [in] Handle to the device context. 
    lpString 
    [in] Pointer to a buffer that specifies the text string. The string does not need to be zero-terminated, because the cbString parameter specifies the length of the string. 
    cbString 
    [in] Specifies the length of the lpString buffer. For the ANSI function it is a BYTE count and for the Unicode function it is a WORD count. Note that for the ANSI function, characters in SBCS code pages take one byte each, while most characters in DBCS code pages take two bytes; for the Unicode function, most currently defined Unicode characters (those in the Basic Multilingual Plane (BMP)) are one WORD while Unicode surrogates are two WORDs. 
    Windows 95/98/Me: This value may not exceed 8192. lpSize 
    [out] Pointer to a SIZE structure that receives the dimensions of the string, in logical units. 
    Return Values
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. Windows NT/2000/XP: To get extended error information, call GetLastError.