This seems to work, I have more testing to do, but
I think it does what I want.
CSize sz = dc.GetTextExtent(m_strBuffer);
if (rc.Width() < sz.cx){
CString strSub, strDisplay;
strSub = "";
for (int i=m_strBuffer.GetLength()-1; i >= 0; i--){
strSub = m_strBuffer[i] + strSub;
sz = dc.GetTextExtent(strSub);
if (sz.cx < rc.Width()){
strDisplay = strSub;
}
else {
sz = dc.GetTextExtent(strDisplay);
SetCaretPos(CPoint(sz.cx + nCellMargin, nTopMargin));
dc.DrawText(strDisplay, rc, unFormat);
break;
}
}
}