Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #9530

Re: Report determining the number of lines in a CanGrow TextBox

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: Report determining the number of lines in a CanGrow TextBox
Date 2014-06-17 16:56 +0100
Organization Aioe.org NNTP Server
Message-ID <lnpoep$psm$1@speranza.aioe.org> (permalink)
References (1 earlier) <lnhph0$jco$1@dont-email.me> <lnn4q2$l18$1@speranza.aioe.org> <lnnh6p$sv7$1@dont-email.me> <lnns3c$nj4$1@speranza.aioe.org> <lnpcbm$5e5$1@dont-email.me>

Show all headers | View raw


> 
> Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As
> Integer)
> 
> ' Reset to twips
> Me.ScaleMode  1
> Me.Scale
> 
> Me.FontName  txtCompanyName.FontName
> Me.FontSize  txtCompanyName.FontSize
> 
> ' Reset to original textbox width
> txtCompanyName.Width  800
> txtCompanyName.Width  Me.TextWidth(txtCompanyName.Value) + 70
> Debug.Print txtCompanyName.Width, Me.TextWidth(txtCompanyName.Value)
> End Sub
> 
> But if ftextwidth() worked for you... why not?
> 
> Ulrich
> 
Using your code (Had to modify it as it wouldn't compile, (Needed “=” signs
and changing the fiddle factor to 150.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    Me.ScaleMode = 1
    Me.Scale
    
    Me.FontName = TxtCompanyName.FontName
    Me.FontSize = TxtCompanyName.FontSize
    
    ' Reset to original textbox width
    'TxtCompanyName.Width = 800
    TxtCompanyName.Width = Me.TextWidth(TxtCompanyName.Value) + 150
Debug.Print rint TxtCompanyName.Width; " ";
Me.TextWidth(TxtCompanyName.Value); _ " "; TxtCompanyName.FontName; " ";
TxtCompanyName.FontSize; _ " "; TxtCompanyName.FontBold; " ";
TxtCompanyName.FontItalic End Sub

I Also changed “Company A” to “Co A” and whatever you put in for me to
“Phil’s very big Company” Record 31 Company is iiiiiiiiii and record 32
company is mmmmmmmmmm to give a variety of lengths. In addition I filtered on
record ID 1, 5 & 30 31 & 32 so that only 5 records came up on the reports and
similar Debugs.

All worked except the Bold Font and the debug window reveals why

TextWidth: 610   FTextWidth: 610   Arial   14    0   False
TextWidth: 1462   FTextWidth: 1462   Arial   14    0   False
TextWidth: 2940   FTextWidth: 2940   Arial   14    0   False
TextWidth: 744   FTextWidth: 749   Arial   14    0   False
TextWidth: 2330   FTextWidth: 2328   Arial   14    0   False

TextWidth: 610   FTextWidth: 636   Arial   14    1   False
TextWidth: 1462   FTextWidth: 1531   Arial   14    1   False
TextWidth: 2940   FTextWidth: 3161   Arial   14    1   False
TextWidth: 744   FTextWidth: 950   Arial   14    1   False
TextWidth: 2330   FTextWidth: 2496   Arial   14    1   False

TextWidth: 610   FTextWidth: 614   Arial   14    0   True
TextWidth: 1462   FTextWidth: 1466   Arial   14    0   True
TextWidth: 2940   FTextWidth: 2954   Arial   14    0   True
TextWidth: 744   FTextWidth: 749   Arial   14    0   True
TextWidth: 2330   FTextWidth: 2328   Arial   14    0   True


The TextWidth seems to take account of the font, it’s size and the big
letters (“m” & “w”) and the small letters (“I” & “J”), but no account of the
bold or italic settings whilst the FTextWidth appears to take them into
account.

Thought you might be interested.

Phil



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Report determining the number of lines in a CanGrow TextBox "Phil" <phil@stantonfamily.co.uk> - 2014-06-14 12:20 +0100
  Re: Report determining the number of lines in a CanGrow TextBox DFS <nospam@dfs.com> - 2014-06-14 09:11 -0400
  Re: Report determining the number of lines in a CanGrow TextBox Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-06-14 17:25 +0200
    Re: Report determining the number of lines in a CanGrow TextBox "Phil" <phil@stantonfamily.co.uk> - 2014-06-16 17:08 +0100
      Re: Report determining the number of lines in a CanGrow TextBox Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-06-16 09:31 -0700
      Re: Report determining the number of lines in a CanGrow TextBox Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-06-16 21:40 +0200
        Re: Report determining the number of lines in a CanGrow TextBox "Phil" <phil@stantonfamily.co.uk> - 2014-06-16 23:46 +0100
          Re: Report determining the number of lines in a CanGrow TextBox Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-06-17 14:29 +0200
            Re: Report determining the number of lines in a CanGrow TextBox "Phil" <phil@stantonfamily.co.uk> - 2014-06-17 16:56 +0100
              Re: Report determining the number of lines in a CanGrow TextBox Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-06-18 10:34 +0200

csiph-web