Re: How many chars can be displayed in a label?



True.Kilted.Scot@xxxxxxxxx wrote:
I have a window in my database which contains 5 labels. These labels
are used for displaying altering text, with a font of Tahoma and a Font
Size of 10.77

For example...the first label might display "Starting........."
initially, and then this may change to "Running...". Once the
"Running..." process has completed, the text may change to "Stage One
Done...", with the second label changing to "Starting........." and so
on.

My question is this:

If each label has the same dimensions, namely:

Width = 7cm
Height = 0.5cm

and any label can display BOLD text as well as NORMAL, is there any way
I can calculate the number of characters that will be displayed within
the 7cm width of the label. For example, the text "The quick brown fox
jumped over the lazy dog" is too big for the box, just cutting of a
portion of the "g". If I change the text to BOLD, it now cuts off
everything after the "z" of lazy.

So, using the font name, the font size and the width of the label, can
I caluclate a rough approximation of the number of characters that can
be displayed in it?


There's may be a combination of API calls that could be used
to figure the number of characters, but I have no idea what
they might be. I have never been concerned with the number
of characters because I have always wanted to determine the
width of the entire string.

If you can live with determining if the string will fit or
not or even how wide the text box needs to be to contain the
entire string, then download the TextHeightWidth db at
www.lebans.com

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: How many chars can be displayed in a label?
    ... are used for displaying altering text, with a font of Tahoma and a Font ... If each label has the same dimensions, ... jumped over the lazy dog" is too big for the box, ...
    (microsoft.public.access.formscoding)
  • Re: Entering Data into a spreadsheet via a UserFrom Advise Please
    ... and the font size. ... If you want to reflect the footer in a label then the best thing is to ... text...I have been displaying the & etc... ...
    (microsoft.public.excel.programming)
  • How many chars can be displayed in a label?
    ... are used for displaying altering text, with a font of Tahoma and a Font ... If each label has the same dimensions, ... jumped over the lazy dog" is too big for the box, ...
    (microsoft.public.access.formscoding)
  • Re: Formatting of chart elements
    ... copy the specific character format ... from the cell to the label. ... special font that includes sub and superscripted characters. ...
    (microsoft.public.excel.charting)
  • Re: creating unicode folder and files
    ... displaying Unicode characters produced with the ChrW function. ... kind of messy if, for example, the font used in the explorer windows does ...
    (microsoft.public.scripting.vbscript)