在对话框上以路径形式显示字符串(当字符串长度过长时,中间的字符串用省略号代替)
CPaintDC dc(this);
CFont NewFont, * pOldFont;
NewFont.CreatePointFont(90, _T("宋体"), NULL);
pOldFont = dc.SelectObject(&NewFont);
dc.SetBkMode(TRANSPARENT);
CRect rect;
//IDC_STATIC_PATH是显示字符串的static控件的ID, 注意控件的要设为不可见
GetDlgItem(IDC_STATIC_PATH)->GetWindowRect(rect);
ScreenToClient(rect);
dc.DrawText(m_strCorePath, -1, rect, DT_LEFT | DT_PATH_ELLIPSIS | DT_VCENTER | DT_SINGLELINE);
dc.SelectObject(pOldFont);