How to stop DrawText from underlining alt characters?

南楼画角 提交于 2019-12-25 19:37:00

问题


I'm using DrawText to draw text onto a DBGrid canvas. The text comes from the database. But when the string contains an ampersand (&) it treats it as an alt shortcut and underlines it.

For example, what should be

Wool & Silk

winds up being

Wool _Silk

How do I stop this behavior?


回答1:


Suppress prefix handling with the DT_NOPREFIX flag. This is the way forward if you know you do not want any prefixes drawn.

If you want to draw text with both prefixes and ampersand, you can escape the ampersand by doubling it up. So pass && when you want a single ampersand.

You can find all this information, and more, in the documentation.



来源:https://stackoverflow.com/questions/20181949/how-to-stop-drawtext-from-underlining-alt-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!