如何确定字符串的大小在wxWidgets中给出当前字体 [英] Howto determine the size of a string give the current font in wxWidgets

查看:42
本文介绍了如何确定字符串的大小在wxWidgets中给出当前字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以根据(C ++)wxWidgets中当前选择的字体来确定给定字符串的显示长度(以像素为单位)?

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

例如,如果我打印出字符串"Speed:",并想在:"和将要跟随的值之间放置10个像素,那么我需要知道"Speed:"字符串有多长时间.有没有办法确定这一点?我似乎在API文档中找不到任何内容,但可能会丢失一些内容.

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.

推荐答案

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

注意:我不是wxWidgets用户.

Note: I'm not a wxWidgets user.

这篇关于如何确定字符串的大小在wxWidgets中给出当前字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆