Resize text to fit control

G

Guest

Hi,

Is it possible to have text automatically resize to fit a text box rather
than the have the Text box grow or shrink

Thanks Sean
 
J

John Vinson

Hi,

Is it possible to have text automatically resize to fit a text box rather
than the have the Text box grow or shrink

Thanks Sean


______________________________________________________
| No. |
______________________________________________________


________________
| Not so far as |
________________

<g>

Seriously, this could be VERY difficult. Most fonts are variable
sizes; just counting letters doesn't get you the width accurately,
you'll need a table identifying the width in twips of a "M" and a
"l", and some rather tricky code to add them up, include the correct
kerning, and then resize the font to fit the textbox.

And as my facetious examples indicate, the result might be unreadably
spread out or jammed together if you did so in any case!

John W. Vinson[MVP]
 
S

Stephen Lebans

See:
http://www.lebans.com/autosizefont.htm
AutoSizeFont.zip is a database containing a function to automatically resize
a Control's Font to fit the current record's contents. Works in the Form's
Current and/or Change events.

Version 2: Updated to use the new ,more accurate, fTextHeight function.

Version 1: First Release
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top