CString strDesc = _T("CRect动态确定");
CRect textRect;
textRect.left = 10;
textRect.top = 10;
//设置textRect.right,并获取字符串高度
int nHeight = pDC->DrawText(strDesc,textRect,DT_SINGLELINE|DT_CALCRECT);
textRect.bottom = textRect.top + nHeight;
//实际输出字符串
pDC->DrawText(strDesc,textRect, DT_SINGLELINE|DT_VCENTER|DT_LEFT);