本帖最后由 sxj0384 于 2011-01-31 21:36:24 编辑

解决方案 »

  1.   

    virtual int DrawText(
       LPCTSTR lpszString,
       int nCount,
       LPRECT lpRect,
       UINT nFormat 
    );
    int DrawText(
       const CString& str,
       LPRECT lpRect,
       UINT nFormat 
    );
     
    Parameters
    lpszString
    Points to the string to be drawn. If nCount is –1, the string must be null-terminated.nCount
    Specifies the number of chars in the string. If nCount is –1, then lpszString is assumed to be a long pointer to a null-terminated string and DrawText computes the character count automatically.lpRect
    Points to a RECT structure or CRect object that contains the rectangle (in logical coordinates) in which the text is to be formatted.(可以指向rect 结构指针或者CRect 对象。)str
    A CString object that contains the specified characters to be drawn.nFormat
    Specifies the method of formatting the text. It can be any combination of the values described for the uFormat parameter in DrawText in the Platform SDK. (combine using the bitwise OR operator):
      

  2.   

    用的是 CRect 的 LPRECT 操作符
    CRect::operator LPRECT