计算文本的宽度 [英] Calculate Width of text

查看:55
本文介绍了计算文本的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉最后一个。


有谁知道如何计算给定字体

名称和大小的文本字符串的宽度?

我想构建一个文本字符串块以显示在未绑定的控件中,

宽度有限但多行。目前我使用左$()

函数将文本修剪为标准字符数。我想要一个

函数来返回适合控件宽度

的字符数。为了保持输出的良好,我不想使用固定的间距

字体。

Sorry about that last one.

Does anyone know how to calculate the width a string of text for given Font
name and size?
I want to buildup a block of text strings to display in a unbound control,
that has limited width but multiple lines. Currently I am using the left$()
function to trim the text to a standard number of characters. I want a
function to return the number of characters that will fit in the width of
the control. To keep the output nice, I don''t want to use a fixed pitch
font.

推荐答案

()

用于将文本修剪为标准字符数。我想要一个

函数来返回适合控件宽度

的字符数。为了保持输出的良好,我不想使用固定的间距

字体。
()
function to trim the text to a standard number of characters. I want a
function to return the number of characters that will fit in the width of
the control. To keep the output nice, I don''t want to use a fixed pitch
font.


2006年5月17日星期三07: 37:52 -0500,paii,Ron < pa ** @ packairinc.com>

写道:


没有简单的方法可以做到这一点。 Windows API GetTextExtent及其

表兄弟会给你一些信息,但这不是一个微不足道的

路线。


-Tom。

On Wed, 17 May 2006 07:37:52 -0500, "paii, Ron" <pa**@packairinc.com>
wrote:

There is no easy way to do this. The Windows API GetTextExtent and its
cousins will give you some information, but this is not a trivial
route to take.

-Tom.

对最后一个感到抱歉。

有谁知道如何计算给定Font的文本字符串的宽度
名称和大小?
我想构建一个文本字符串块以显示在未绑定的控件中,
宽度有限但多行。目前我使用左
Sorry about that last one.

Does anyone know how to calculate the width a string of text for given Font
name and size?
I want to buildup a block of text strings to display in a unbound control,
that has limited width but multiple lines. Currently I am using the left


()
函数将文本修剪为标准字符数。我想要一个
函数来返回适合控件宽度的字符数。为了保持输出的美观,我不想使用固定的间距
字体。
()
function to trim the text to a standard number of characters. I want a
function to return the number of characters that will fit in the width of
the control. To keep the output nice, I don''t want to use a fixed pitch
font.






这篇关于计算文本的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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