If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
'font size to fit' textbox
Anyone know how to dynamically reduce the font size of text within a
textbox so that all text within a field will always be printed on one line? I'm not talking about text wrapping or (CanGrow/CanShrink) type functions. |
#2
|
|||
|
|||
'font size to fit' textbox
Dale:
Stop by www.lebans.com, Stephen has a utility that can assist you here, look in the downloads area I believe. -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg "Dale Walker" wrote in message ... Anyone know how to dynamically reduce the font size of text within a textbox so that all text within a field will always be printed on one line? I'm not talking about text wrapping or (CanGrow/CanShrink) type functions. |
#3
|
|||
|
|||
'font size to fit' textbox
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. -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Dale Walker" wrote in message ... Anyone know how to dynamically reduce the font size of text within a textbox so that all text within a field will always be printed on one line? I'm not talking about text wrapping or (CanGrow/CanShrink) type functions. |
#4
|
|||
|
|||
'font size to fit' textbox
On Sat, 29 May 2004 11:33:15 -0300, "Stephen Lebans"
wrote: 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. Works great in Forms but how do I get it to work in Reports? ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#5
|
|||
|
|||
'font size to fit' textbox
The code in the sample Form must be copied to your Report.
Form Load event - Report Open event Form Current event - Relevant Report Section Format event(Detail in most cases) -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Dale Walker" wrote in message ... On Sat, 29 May 2004 11:33:15 -0300, "Stephen Lebans" wrote: 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. Works great in Forms but how do I get it to work in Reports? ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#6
|
|||
|
|||
'font size to fit' textbox
On Sat, 29 May 2004 14:12:11 -0300, "Stephen Lebans"
wrote: The code in the sample Form must be copied to your Report. Form Load event - Report Open event Form Current event - Relevant Report Section Format event(Detail in most cases) Sorry, still not working. Code barfs at the me.repaint line (compile error: method or data member not found). Doesn't .repaint only apply to forms? ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#7
|
|||
|
|||
'font size to fit' textbox
The Repaint method is only for Forms - just comment it out.
-- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Dale Walker" wrote in message ... On Sat, 29 May 2004 14:12:11 -0300, "Stephen Lebans" wrote: The code in the sample Form must be copied to your Report. Form Load event - Report Open event Form Current event - Relevant Report Section Format event(Detail in most cases) Sorry, still not working. Code barfs at the me.repaint line (compile error: method or data member not found). Doesn't .repaint only apply to forms? ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#8
|
|||
|
|||
'font size to fit' textbox
On Mon, 31 May 2004 22:44:48 -0300, "Stephen Lebans"
wrote: The Repaint method is only for Forms - just comment it out. Tried that, no errors but no size change either. One thing that might conceivably be a problem is that I'm using Japanese characters instead of ASCII. Also using Access 2003. ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#9
|
|||
|
|||
'font size to fit' textbox
You said the sample Form worked on your system so you should be able to
get the Report working as well. I just saved the Sample Form as a Report. Copied the Form's Load event to the Report's Open event. Copied the Form's Current event to the Report Detail Section's Format event and everything worked fine. Here is the code behind my Report. Option Compare Database Option Explicit Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Dim lngTextHeight As Long With Me.txtExtraInfo ' Copy the original Font height from the Tag property .fontsize = .Tag Do While .fontsize 2 lngTextHeight = fTextHeight(Me.txtExtraInfo) ' Does text fit? If yes then exit If lngTextHeight .Height Then Exit Do ' Decrease font height .fontsize = .fontsize - 1 Loop End With End Sub Private Sub Report_Open(Cancel As Integer) ' Copy the TextBox default Fontsize to its Tag property. Me.txtExtraInfo.Tag = Me.txtExtraInfo.fontsize End Sub -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "Dale Walker" wrote in message ... On Mon, 31 May 2004 22:44:48 -0300, "Stephen Lebans" wrote: The Repaint method is only for Forms - just comment it out. Tried that, no errors but no size change either. One thing that might conceivably be a problem is that I'm using Japanese characters instead of ASCII. Also using Access 2003. ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
#10
|
|||
|
|||
'font size to fit' textbox
On Tue, 1 Jun 2004 00:37:58 -0300, "Stephen Lebans"
wrote: You said the sample Form worked on your system so you should be able to get the Report working as well. I think I've spotted the problem. It occurs in both form and report versions. To make Japanese 'vertical' text, I was making the width of the textbox just one character wide, so that the sentence would wrap down. I've got a feeling Access (or the code) can't work out the correct width of doublebyte characters and therefore miscalculates the number of lines needed to fit in the height of the textbox. If I add a newline between characters (or before any wrapping takes place for wider examples), it works fine. I'll have a go at rejigging the code but I'm that hot on VB (especially when jiggling with twips and wotnot) Also, I don't suppose you have a horizontal font scaler knocking around anywhere (one that'll stick the whole field on one line)? That'll come in handy for the next little projectette I have. ------------------------------------------------------------- Dale Walker: London Techno Events: , london.sorted.org Saiko: , saiko.sorted.org |
Thread Tools | |
Display Modes | |
|
|