我的定义如下
      CString  r;
        r的内容为:
       "adfjhdfh"+"\n"+"sdjfkj"+"\n"+"dsfdsjfh";
      现在用textout()输出,希望能够如以下:
           adfjhdfh
           sdjfkj
           dsfdsjfh
     请问如何实现

解决方案 »

  1.   

    int DrawTextEx(
      HDC hdc,                     // handle to device context
      LPTSTR lpchText,             // pointer to string to draw
      int cchText,                 // length of string to draw
      LPRECT lprc,                 // pointer to rectangle coordinates
      UINT dwDTFormat,             // formatting options
      LPDRAWTEXTPARAMS lpDTParams  // pointer to struct with options
    );
     这个功能很强
      

  2.   

    void CXXXView::OnDraw(CDC* pDC)
    {
    CTestsin3Doc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    CString s="adfasl\r\nalsasd\r\nasldsafasdfsadf";
    CRect r;
    GetClientRect(r);
    pDC->DrawText(s,r,DT_BOTTOM);
    // TODO: add draw code for native data here
    }
      

  3.   

    r.Replace("\n", "\r\n");相信会满足你的要求。