串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)
50.串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)
[问题提出]
如何在串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)?
[程序实现]
建立名为My的SDI或MDI工程.
void CMyView::OnDraw(CDC* pDC)
{
CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->DrawText(CString("It's a long string,so we will add a '...' at the end."),CRect (110, 110, 180, 130),DT_LEFT | DT_END_ELLIPSIS);
//Add ellpsis to middle of string if it does not fit
pDC->DrawText(CString("It's a long string,so we will add a '...' at the end."),CRect (110, 140, 300, 160),DT_LEFT | DT_PATH_ELLIPSIS);
}
[问题提出]
如何在串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)?
[程序实现]
建立名为My的SDI或MDI工程.
void CMyView::OnDraw(CDC* pDC)
{
CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->DrawText(CString("It's a long string,so we will add a '...' at the end."),CRect (110, 110, 180, 130),DT_LEFT | DT_END_ELLIPSIS);
//Add ellpsis to middle of string if it does not fit
pDC->DrawText(CString("It's a long string,so we will add a '...' at the end."),CRect (110, 140, 300, 160),DT_LEFT | DT_PATH_ELLIPSIS);
}
上一篇:std::find,std::find_if使用小结
下一篇:MFC Telnet Application(mfc telnet 端口,代码实现、不调用telnet.exe)