Auto sizing text.

vorn666

Registered User.
Local time
Today, 23:58
Joined
Mar 5, 2007
Messages
10
If you have a text box of a set size how would I code an automatic font size reduction if the text string in it was too long. (It has to shrink or it obscures the box below it). ie if it is over so many characters set size 14, if over even more set size 12 etc.

many thanks.

This is on a form limited to holding only a single records information.
 
on this check the samples - some clever bunny has done this already ...
 
I don't doubt it, however I cannot find it. I am unsure exactly which words I should be searching under as I do not know the correct name for what i am trying to do.
 
This is for demonstration purposes only! You'll have to play around with the text lengths and font sizes to suit your purposes.

Code:
Private Sub MyText_AfterUpdate()
If Len(Me.MyText) => 12 And Len(Me.MyText) =< 16 Then
  MyText.FontSize = 10
 ElseIf  MyText.FontSize =>17 And Len(Me.MyText) =< 22 Then
  MyText.FontSize = 8
End Sub

Private Sub Form_Current()
If Len(Me.MyText) => 12 And Len(Me.MyText) =< 16 Then
  MyText.FontSize = 10
 ElseIf  MyText.FontSize =>17 And Len(Me.MyText) =< 22 Then
  MyText.FontSize = 8
 End If
 

Users who are viewing this thread

Back
Top Bottom