分享

如何在串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)?

 zybingliu 2007-11-15
http://www./bbs/prime/viewprime.asp?id=117
 

如何在串太长时往让其末尾显示一个省略号(在SDI或MDI的View中)?
(VCKBASE发表于2001-8-17 20:06:27)

  [问题提出]
    如何在串太长时往让其末尾显示一个省略号(在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);
    }
    运行看看.
结果:

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多