Howto determine the size of a string give the current font in wxWidgets

Deadly 提交于 2019-12-20 03:37:11

问题


Is there a way to determine the display length of a given string (in pixels) based on the currently selected font in (C++) wxWidgets?

For example if I print out the string "Speed:" and want to put 10 pixels between the ':' and the value about to follow, I need to know how long the "Speed:" string was. Is there a way to determine this? I can't seem to find anything in the API documentation but I may be missing something.


回答1:


Maybe http://docs.wxwidgets.org/stable/wx_wxdc.html#wxdcgettextextent ?

Note: I'm not a wxWidgets user.



来源:https://stackoverflow.com/questions/241516/howto-determine-the-size-of-a-string-give-the-current-font-in-wxwidgets

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