DT_WORDBREAK、DT_PATH_ELLIPSIS和DT_WORD_ELLIPSIS的使用

本文介绍了在Windows编程中如何使用CDC::DrawText函数的DT_WORDBREAK、DT_PATH_ELLIPSIS和DT_WORD_ELLIPSIS参数来格式化文本,包括文本换行、路径省略和单词省略等效果。同时,文章提到了某些参数组合可能修改传入字符串并导致问题,以及如何通过设置不同标志实现预期的文本显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

看一下MSDN上关于这些参数的说明:
CDC::DrawText

Send Feedback on this topic to Microsoft. OnlineView this topic online in your default browser.

Call this member function to format text in the given rectangle. To specify additional formatting options, use CDC::DrawTextEx.

View ColorizedCopy to Clipboardvirtual int DrawText(
LPCTSTR lpszString,
int nCount,
LPRECT lpRect,
UINT nFormat
);
int DrawText(
const CString& str,
LPRECT lpRect,
UINT nFormat
);
virtual int DrawText(
LPCTSTR lpszString,
int nCount,
LPRECT lpRect,
UINT nFormat
);
int DrawText(
const CString& str,
LPRECT lpRect,
UINT nFormat
);

Parameters

lpszString
Points to the string to be drawn. If nCount is –1, the string must be null-terminated.

nCount
Specifies the number of chars in the string. If nCount is –1, then lpszString is

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值