textbox size 
Author Message
 textbox size

I am programming on a 17" - 1280 X 1024 screen and of course forms overlap
smaller screens.  This routine seems to work, except.....

Everything seems to set right except Text1(0).Height and Text1(8).Height.
They come out to the size setup originally in the Properties.  If you will
notice below the for-next routine, I reset those two values again and they
show correctly on the screen.  Nowhere else in the routine are these values
messed with.

Another anomaly.   After completing the routine printout, it calls 'sub
again'  to start over and this time it shows the two rogue textboxes correct
without the reset after the for-next.

Can anyone see what I am not?  I even moved Form1.show around to different
places (before and after) and that doesn't seem to change anything.

Glenn

Sub again()

intCurrResX = Screen.Width / Screen.TwipsPerPixelX
intCurrResY = Screen.Height / Screen.TwipsPerPixelY
     Form1.Show

REM     W = intCurrResX / 1280: H = intCurrResY / 1024

     W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

     Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
     Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
     Form1.FontSize = Int(14 * W)

     Y = 500 * H       '------------set top line
     For X = 0 To 8
          Y = Y + 500 * H     '----line increment
          Text1(X).Top = Y
          Text1(X).Text = ""
          Text1(X).Left = 8000 * W
          Text1(X).Width = 1200 * W
          Text1(X).Height = 400 * H
          Text1(X).FontSize = Int(14 * W)
          Text1(X).Visible = True
          Label1(X + 1).Top = Y
          Label1(X + 1).FontSize = Int(14 * W)
          Label1(X + 1).Left = 1500 * W
          Label1(X + 1).Width = 6400 * W
          Label1(X + 1).Height = 400 * H
          Label1(X + 1).Visible = True
          heatray(X + 1) = 0
     Next

     Text1(0).Height = 400 * H    '---- have to reset
     Text1(0).SetFocus
     Text1(8).Height = 400 * H    '---- have to reset

     Text2.Top = 8500 * H
     Text2.Left = 1650 * W
     Text2.Width = 8250 * W
     Text2.Height = 400 * H
     Text2.FontSize = Int(14 * W)
     Text2.Visible = False

End Sub



Sat, 11 Sep 2004 06:57:41 GMT  
 textbox size
Stumped me too.  (G)

Glenn


Quote:
> I am programming on a 17" - 1280 X 1024 screen and of course forms overlap
> smaller screens.  This routine seems to work, except.....

> Everything seems to set right except Text1(0).Height and Text1(8).Height.
> They come out to the size setup originally in the Properties.  If you will
> notice below the for-next routine, I reset those two values again and they
> show correctly on the screen.  Nowhere else in the routine are these
values
> messed with.

> Another anomaly.   After completing the routine printout, it calls 'sub
> again'  to start over and this time it shows the two rogue textboxes
correct
> without the reset after the for-next.

> Can anyone see what I am not?  I even moved Form1.show around to different
> places (before and after) and that doesn't seem to change anything.

> Glenn

> Sub again()

> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
>      Form1.Show

> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
>      Form1.FontSize = Int(14 * W)

>      Y = 500 * H       '------------set top line
>      For X = 0 To 8
>           Y = Y + 500 * H     '----line increment
>           Text1(X).Top = Y
>           Text1(X).Text = ""
>           Text1(X).Left = 8000 * W
>           Text1(X).Width = 1200 * W
>           Text1(X).Height = 400 * H
>           Text1(X).FontSize = Int(14 * W)
>           Text1(X).Visible = True
>           Label1(X + 1).Top = Y
>           Label1(X + 1).FontSize = Int(14 * W)
>           Label1(X + 1).Left = 1500 * W
>           Label1(X + 1).Width = 6400 * W
>           Label1(X + 1).Height = 400 * H
>           Label1(X + 1).Visible = True
>           heatray(X + 1) = 0
>      Next

>      Text1(0).Height = 400 * H    '---- have to reset
>      Text1(0).SetFocus
>      Text1(8).Height = 400 * H    '---- have to reset

>      Text2.Top = 8500 * H
>      Text2.Left = 1650 * W
>      Text2.Width = 8250 * W
>      Text2.Height = 400 * H
>      Text2.FontSize = Int(14 * W)
>      Text2.Visible = False

> End Sub



Mon, 13 Sep 2004 06:01:00 GMT  
 textbox size
Glenn,

I get the same results either commenting out setting the Text Box height OR not.
However, the logic only works when width is set after font.  I believe VB scales Text Boxes' height by the font and your resetting
the height are countermanding its effort? This seems especially true as fonts do not scale a precisely as lines!

If I set width before the font setting, the boxes acquire an extra separation between them and are not scaled.

Sub again()

  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
  Form1.Show

  W = intCurrResX / 1280: H = intCurrResY / 1024

  'W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
  Form1.FontSize = Int(14 * W)

  Y = 500 * H                       '------------set top line
  For X = 0 To Text1.UBound
    Y = Y + 500 * H                 '----line increment
    Text1(X).Top = Y
    Text1(X).Left = 8000 * W
    Text1(X).FontSize = Int(14 * W)
    Text1(X).Width = 1200 * W
'    Text1(X).Height = 400 * H
    Text1(X).Visible = True
  Next
End Sub

Private Sub Command_Click()
  again
End Sub
--
Regards,
Billy Joe

B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M

Quote:

> I am programming on a 17" - 1280 X 1024 screen and of course forms overlap
> smaller screens.  This routine seems to work, except.....

> Everything seems to set right except Text1(0).Height and Text1(8).Height.
> They come out to the size setup originally in the Properties.  If you will
> notice below the for-next routine, I reset those two values again and they
> show correctly on the screen.  Nowhere else in the routine are these values
> messed with.

> Another anomaly.   After completing the routine printout, it calls 'sub
> again'  to start over and this time it shows the two rogue textboxes correct
> without the reset after the for-next.

> Can anyone see what I am not?  I even moved Form1.show around to different
> places (before and after) and that doesn't seem to change anything.

> Glenn

> Sub again()

> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
>      Form1.Show

> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
>      Form1.FontSize = Int(14 * W)

>      Y = 500 * H       '------------set top line
>      For X = 0 To 8
>           Y = Y + 500 * H     '----line increment
>           Text1(X).Top = Y
>           Text1(X).Text = ""
>           Text1(X).Left = 8000 * W
>           Text1(X).Width = 1200 * W
>           Text1(X).Height = 400 * H
>           Text1(X).FontSize = Int(14 * W)
>           Text1(X).Visible = True
>           Label1(X + 1).Top = Y
>           Label1(X + 1).FontSize = Int(14 * W)
>           Label1(X + 1).Left = 1500 * W
>           Label1(X + 1).Width = 6400 * W
>           Label1(X + 1).Height = 400 * H
>           Label1(X + 1).Visible = True
>           heatray(X + 1) = 0
>      Next

>      Text1(0).Height = 400 * H    '---- have to reset
>      Text1(0).SetFocus
>      Text1(8).Height = 400 * H    '---- have to reset

>      Text2.Top = 8500 * H
>      Text2.Left = 1650 * W
>      Text2.Width = 8250 * W
>      Text2.Height = 400 * H
>      Text2.FontSize = Int(14 * W)
>      Text2.Visible = False

> End Sub



Mon, 13 Sep 2004 08:28:02 GMT  
 textbox size
I haven't tried that yet but what you say really makes sense.  In a
labelbox, fontsize 14 will size in Properties to 350 Twips but a textbox w/
fontsize 14 will default to 438 Twips (twits?) in Properties.  What still
makes no sense though, is why only the first and last and why on a re-run
call, it doesn't show any peculiarities at all.

Of course on a non-trial run I rem out the( * W ) in TwipsPerPixelX * W  and
the( * H ) in TwipsPerPixelY * H because on another machine they aren't
needed.


Quote:
> Glenn,

> I get the same results either commenting out setting the Text Box height
OR not.
> However, the logic only works when width is set after font.  I believe VB

scales Text Boxes' height by the font and your resetting
Quote:
> the height are countermanding its effort? This seems especially true as

fonts do not scale a precisely as lines!
Quote:

> If I set width before the font setting, the boxes acquire an extra

separation between them and are not scaled.
Quote:

> Sub again()

>   intCurrResX = Screen.Width / Screen.TwipsPerPixelX
>   intCurrResY = Screen.Height / Screen.TwipsPerPixelY
>   Form1.Show

>   W = intCurrResX / 1280: H = intCurrResY / 1024

>   'W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

>   Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
>   Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
>   Form1.FontSize = Int(14 * W)

>   Y = 500 * H                       '------------set top line
>   For X = 0 To Text1.UBound
>     Y = Y + 500 * H                 '----line increment
>     Text1(X).Top = Y
>     Text1(X).Left = 8000 * W
>     Text1(X).FontSize = Int(14 * W)
>     Text1(X).Width = 1200 * W
> '    Text1(X).Height = 400 * H
>     Text1(X).Visible = True
>   Next
> End Sub

> Private Sub Command_Click()
>   again
> End Sub
> --
> Regards,
> Billy Joe

> B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M




- Show quoted text -

Quote:
> > I am programming on a 17" - 1280 X 1024 screen and of course forms
overlap
> > smaller screens.  This routine seems to work, except.....

> > Everything seems to set right except Text1(0).Height and
Text1(8).Height.
> > They come out to the size setup originally in the Properties.  If you
will
> > notice below the for-next routine, I reset those two values again and
they
> > show correctly on the screen.  Nowhere else in the routine are these
values
> > messed with.

> > Another anomaly.   After completing the routine printout, it calls 'sub
> > again'  to start over and this time it shows the two rogue textboxes
correct
> > without the reset after the for-next.

> > Can anyone see what I am not?  I even moved Form1.show around to
different
> > places (before and after) and that doesn't seem to change anything.

> > Glenn

> > Sub again()

> > intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> > intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> >      Form1.Show

> > REM     W = intCurrResX / 1280: H = intCurrResY / 1024

> >      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

> >      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> >      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> >      Form1.FontSize = Int(14 * W)

> >      Y = 500 * H       '------------set top line
> >      For X = 0 To 8
> >           Y = Y + 500 * H     '----line increment
> >           Text1(X).Top = Y
> >           Text1(X).Text = ""
> >           Text1(X).Left = 8000 * W
> >           Text1(X).Width = 1200 * W
> >           Text1(X).Height = 400 * H
> >           Text1(X).FontSize = Int(14 * W)
> >           Text1(X).Visible = True
> >           Label1(X + 1).Top = Y
> >           Label1(X + 1).FontSize = Int(14 * W)
> >           Label1(X + 1).Left = 1500 * W
> >           Label1(X + 1).Width = 6400 * W
> >           Label1(X + 1).Height = 400 * H
> >           Label1(X + 1).Visible = True
> >           heatray(X + 1) = 0
> >      Next

> >      Text1(0).Height = 400 * H    '---- have to reset
> >      Text1(0).SetFocus
> >      Text1(8).Height = 400 * H    '---- have to reset

> >      Text2.Top = 8500 * H
> >      Text2.Left = 1650 * W
> >      Text2.Width = 8250 * W
> >      Text2.Height = 400 * H
> >      Text2.FontSize = Int(14 * W)
> >      Text2.Visible = False

> > End Sub



Mon, 13 Sep 2004 09:27:53 GMT  
 textbox size
On Thu, 28 Mar 2002 00:28:02 GMT, "Billy Joe"

Quote:

>Glenn,

>I get the same results either commenting out setting the Text Box height OR not.
>However, the logic only works when width is set after font.  I believe VB scales Text Boxes' height by the font and your resetting
>the height are countermanding its effort? This seems especially true as fonts do not scale a precisely as lines!

Yup - VB resets the height of a Textbox to something that suits its
Font size.
Quote:

>If I set width before the font setting, the boxes acquire an extra separation between them and are not scaled.

>Sub again()

>  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
>  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
>  Form1.Show

>  W = intCurrResX / 1280: H = intCurrResY / 1024

>  'W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

>  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
>  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
>  Form1.FontSize = Int(14 * W)

>  Y = 500 * H                       '------------set top line
>  For X = 0 To Text1.UBound
>    Y = Y + 500 * H                 '----line increment
>    Text1(X).Top = Y
>    Text1(X).Left = 8000 * W
>    Text1(X).FontSize = Int(14 * W)
>    Text1(X).Width = 1200 * W
>'    Text1(X).Height = 400 * H
>    Text1(X).Visible = True
>  Next
>End Sub

>Private Sub Command_Click()
>  again
>End Sub
>--
>Regards,
>Billy Joe

>B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M


>> I am programming on a 17" - 1280 X 1024 screen and of course forms overlap
>> smaller screens.  This routine seems to work, except.....

>> Everything seems to set right except Text1(0).Height and Text1(8).Height.
>> They come out to the size setup originally in the Properties.  If you will
>> notice below the for-next routine, I reset those two values again and they
>> show correctly on the screen.  Nowhere else in the routine are these values
>> messed with.

>> Another anomaly.   After completing the routine printout, it calls 'sub
>> again'  to start over and this time it shows the two rogue textboxes correct
>> without the reset after the for-next.

>> Can anyone see what I am not?  I even moved Form1.show around to different
>> places (before and after) and that doesn't seem to change anything.

>> Glenn

>> Sub again()

>> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
>> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
>>      Form1.Show

>> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

>>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

>>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
>>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
>>      Form1.FontSize = Int(14 * W)

>>      Y = 500 * H       '------------set top line
>>      For X = 0 To 8
>>           Y = Y + 500 * H     '----line increment
>>           Text1(X).Top = Y
>>           Text1(X).Text = ""
>>           Text1(X).Left = 8000 * W
>>           Text1(X).Width = 1200 * W
>>           Text1(X).Height = 400 * H
>>           Text1(X).FontSize = Int(14 * W)
>>           Text1(X).Visible = True
>>           Label1(X + 1).Top = Y
>>           Label1(X + 1).FontSize = Int(14 * W)
>>           Label1(X + 1).Left = 1500 * W
>>           Label1(X + 1).Width = 6400 * W
>>           Label1(X + 1).Height = 400 * H
>>           Label1(X + 1).Visible = True
>>           heatray(X + 1) = 0
>>      Next

>>      Text1(0).Height = 400 * H    '---- have to reset
>>      Text1(0).SetFocus
>>      Text1(8).Height = 400 * H    '---- have to reset

>>      Text2.Top = 8500 * H
>>      Text2.Left = 1650 * W
>>      Text2.Width = 8250 * W
>>      Text2.Height = 400 * H
>>      Text2.FontSize = Int(14 * W)
>>      Text2.Visible = False

>> End Sub



Mon, 13 Sep 2004 17:50:06 GMT  
 textbox size
There a few things that you may not be aware of that may help you here:

1. You cannot set the size of a font to any value you want. This is because
Windows does all its graphic work in pixels and it therefore likes to set
the font size to a value that will result in an integer pixel value. So, if
you are running at the standard Windows Small Fonts Setting (15 Twips per
pixel) then Windows will set display font sizes to the nearest value that
results in an exact multiple of 15 Twips (or an integer value of pixels).
For example, if you set a Text Box font to Arial size 10 (which is
effectively asking for a font size of 200 Twips, since there are always 20
Twips per Point) then you are effectively asking Windows to set the font
size to 200/15 pixels (since there are 15 Twips per Pixel at the standard
Windows setting as mentioned above). That means you are asking Windows for a
font size of (10 * 20) / 15 =  13.3333 pixels. Windows doesn't like this,
and so it will actually set the font size to 9.75 Points, resulting in a
font size of (9.75 * 20) / 15 = 13 pixels. Ask for a size of 12, however,
and you will get what you ask for, because (12 * 20) / 15 = 16 and is an
integer. Try it:

Me.FontName = "Arial"
Me.FontSize = 10
Print Me.FontSize
Me.FontSize = 12
Print Me.FontSize

2.  The TextHeight of a font is *not* the same as its font size would
indicate. It is a small percentage greater than that value. For example,
using a font of Arial size 12 the point size (12) would seem to indicate
that the TextHeight is 12 * 20 = 240 Twips. If you ask for the height,
though, you will get the answer 270.

3. The VB IDE will allow you to set the height of a Text Box to a value less
than that required to display the full height of the text it contains - but
only if you "drag" it to size it. The Properties Window (or standard VB
code) will not let you do this, and will force the value to the minimum
required if you try to set it to a lower value. So, when sizing your TextBox
(height) you should always do it in the Properties Windows, rather than by
manually dragging its size out. If, for example, you want the initial height
to be set at the minimum value achievbable in code then first set the Font
to the desirted size and then enter zero for the Height in the Properties
Window. VB will then set its actual height to the minimum value. For
example, if you set the font to Arial 12 and enter zero in the Height in
Proiperties you will get a value of 270 Twips (if the Text Box has no border
and 390 Twips if it has a standard border). The extra 120 Twips for a Text
Box with a border is because the standard borders are 4 pixels at both the
top and bottom = (4 * 2 * 15) = 120 Twips.

4. When you set the height of a Text Box in code then you will not be able
to set it to anything less than the minimum value (as explained in para 3).

5. There is actually quite a bit more I could say on this subject, but
Maureen is dragging me away from this computer and is telli . . . . .
Arghh!!!  . . . . .

Mike


Quote:
> I haven't tried that yet but what you say really makes sense.  In a
> labelbox, fontsize 14 will size in Properties to 350 Twips but a textbox
w/
> fontsize 14 will default to 438 Twips (twits?) in Properties.  What still
> makes no sense though, is why only the first and last and why on a re-run
> call, it doesn't show any peculiarities at all.



Mon, 13 Sep 2004 18:52:38 GMT  
 textbox size
I thank you for all the thoughts and I am sure you old time programmers are
right in everything listed here...........

BUT

It DOES set all but the first and last textbox to my requested size and on a
second pass even sets those to my request.  Even on the first pass, I can
reassign the two rogue boxes and they behave.  The font seems to set right
because if you noticed, I force the fraction to an integer and Ariel accepts
about all sizes in that range.

I confess I haven't had time to reverse the height and fontsize settings yet
but in a for next loop, I am setting each array individually.  I am
mystified as why all of them accept the setting except the first and last
and they accept it in a separate setting.

BTW There must be a better way to adjust everything to a different screen
resolution.  How do you guys do it?

See you tomorrow.  Today is our 50th wedding anniversary.

Glenn


Quote:
> On Thu, 28 Mar 2002 00:28:02 GMT, "Billy Joe"

> >Glenn,

> >I get the same results either commenting out setting the Text Box height
OR not.
> >However, the logic only works when width is set after font.  I believe VB

scales Text Boxes' height by the font and your resetting
Quote:
> >the height are countermanding its effort? This seems especially true as

fonts do not scale a precisely as lines!
Quote:
> Yup - VB resets the height of a Textbox to something that suits its
> Font size.

> >If I set width before the font setting, the boxes acquire an extra

separation between them and are not scaled.
Quote:

> >Sub again()

> >  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> >  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> >  Form1.Show

> >  W = intCurrResX / 1280: H = intCurrResY / 1024

> >  'W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

> >  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> >  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> >  Form1.FontSize = Int(14 * W)

> >  Y = 500 * H                       '------------set top line
> >  For X = 0 To Text1.UBound
> >    Y = Y + 500 * H                 '----line increment
> >    Text1(X).Top = Y
> >    Text1(X).Left = 8000 * W
> >    Text1(X).FontSize = Int(14 * W)
> >    Text1(X).Width = 1200 * W
> >'    Text1(X).Height = 400 * H
> >    Text1(X).Visible = True
> >  Next
> >End Sub

> >Private Sub Command_Click()
> >  again
> >End Sub
> >--
> >Regards,
> >Billy Joe

> >B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M




- Show quoted text -

Quote:
> >> I am programming on a 17" - 1280 X 1024 screen and of course forms
overlap
> >> smaller screens.  This routine seems to work, except.....

> >> Everything seems to set right except Text1(0).Height and
Text1(8).Height.
> >> They come out to the size setup originally in the Properties.  If you
will
> >> notice below the for-next routine, I reset those two values again and
they
> >> show correctly on the screen.  Nowhere else in the routine are these
values
> >> messed with.

> >> Another anomaly.   After completing the routine printout, it calls 'sub
> >> again'  to start over and this time it shows the two rogue textboxes
correct
> >> without the reset after the for-next.

> >> Can anyone see what I am not?  I even moved Form1.show around to
different
> >> places (before and after) and that doesn't seem to change anything.

> >> Glenn

> >> Sub again()

> >> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> >> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> >>      Form1.Show

> >> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

> >>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

> >>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> >>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> >>      Form1.FontSize = Int(14 * W)

> >>      Y = 500 * H       '------------set top line
> >>      For X = 0 To 8
> >>           Y = Y + 500 * H     '----line increment
> >>           Text1(X).Top = Y
> >>           Text1(X).Text = ""
> >>           Text1(X).Left = 8000 * W
> >>           Text1(X).Width = 1200 * W
> >>           Text1(X).Height = 400 * H
> >>           Text1(X).FontSize = Int(14 * W)
> >>           Text1(X).Visible = True
> >>           Label1(X + 1).Top = Y
> >>           Label1(X + 1).FontSize = Int(14 * W)
> >>           Label1(X + 1).Left = 1500 * W
> >>           Label1(X + 1).Width = 6400 * W
> >>           Label1(X + 1).Height = 400 * H
> >>           Label1(X + 1).Visible = True
> >>           heatray(X + 1) = 0
> >>      Next

> >>      Text1(0).Height = 400 * H    '---- have to reset
> >>      Text1(0).SetFocus
> >>      Text1(8).Height = 400 * H    '---- have to reset

> >>      Text2.Top = 8500 * H
> >>      Text2.Left = 1650 * W
> >>      Text2.Width = 8250 * W
> >>      Text2.Height = 400 * H
> >>      Text2.FontSize = Int(14 * W)
> >>      Text2.Visible = False

> >> End Sub



Mon, 13 Sep 2004 22:24:45 GMT  
 textbox size
Its often difficult for people to sort out problems of this nature unless
they have seen the actual Form you are using. There may be something
different in the two Text Boxes you mention, or there may be some other
problem. Email the project to me and I will have a look at it.

Mike


Quote:
> I thank you for all the thoughts and I am sure you old time programmers
are
> right in everything listed here...........

> BUT

> It DOES set all but the first and last textbox to my requested size and on
a
> second pass even sets those to my request.  Even on the first pass, I can
> reassign the two rogue boxes and they behave.  The font seems to set right
> because if you noticed, I force the fraction to an integer and Ariel
accepts
> about all sizes in that range.

> I confess I haven't had time to reverse the height and fontsize settings
yet
> but in a for next loop, I am setting each array individually.  I am
> mystified as why all of them accept the setting except the first and last
> and they accept it in a separate setting.

> BTW There must be a better way to adjust everything to a different screen
> resolution.  How do you guys do it?

> See you tomorrow.  Today is our 50th wedding anniversary.

> Glenn



> > On Thu, 28 Mar 2002 00:28:02 GMT, "Billy Joe"

> > >Glenn,

> > >I get the same results either commenting out setting the Text Box
height
> OR not.
> > >However, the logic only works when width is set after font.  I believe
VB
> scales Text Boxes' height by the font and your resetting
> > >the height are countermanding its effort? This seems especially true as
> fonts do not scale a precisely as lines!
> > Yup - VB resets the height of a Textbox to something that suits its
> > Font size.

> > >If I set width before the font setting, the boxes acquire an extra
> separation between them and are not scaled.

> > >Sub again()

> > >  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> > >  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> > >  Form1.Show

> > >  W = intCurrResX / 1280: H = intCurrResY / 1024

> > >  'W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

> > >  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> > >  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> > >  Form1.FontSize = Int(14 * W)

> > >  Y = 500 * H                       '------------set top line
> > >  For X = 0 To Text1.UBound
> > >    Y = Y + 500 * H                 '----line increment
> > >    Text1(X).Top = Y
> > >    Text1(X).Left = 8000 * W
> > >    Text1(X).FontSize = Int(14 * W)
> > >    Text1(X).Width = 1200 * W
> > >'    Text1(X).Height = 400 * H
> > >    Text1(X).Visible = True
> > >  Next
> > >End Sub

> > >Private Sub Command_Click()
> > >  again
> > >End Sub
> > >--
> > >Regards,
> > >Billy Joe

> > >B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M



> > >> I am programming on a 17" - 1280 X 1024 screen and of course forms
> overlap
> > >> smaller screens.  This routine seems to work, except.....

> > >> Everything seems to set right except Text1(0).Height and
> Text1(8).Height.
> > >> They come out to the size setup originally in the Properties.  If you
> will
> > >> notice below the for-next routine, I reset those two values again and
> they
> > >> show correctly on the screen.  Nowhere else in the routine are these
> values
> > >> messed with.

> > >> Another anomaly.   After completing the routine printout, it calls
'sub
> > >> again'  to start over and this time it shows the two rogue textboxes
> correct
> > >> without the reset after the for-next.

> > >> Can anyone see what I am not?  I even moved Form1.show around to
> different
> > >> places (before and after) and that doesn't seem to change anything.

> > >> Glenn

> > >> Sub again()

> > >> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> > >> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> > >>      Form1.Show

> > >> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

> > >>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

> > >>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> > >>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> > >>      Form1.FontSize = Int(14 * W)

> > >>      Y = 500 * H       '------------set top line
> > >>      For X = 0 To 8
> > >>           Y = Y + 500 * H     '----line increment
> > >>           Text1(X).Top = Y
> > >>           Text1(X).Text = ""
> > >>           Text1(X).Left = 8000 * W
> > >>           Text1(X).Width = 1200 * W
> > >>           Text1(X).Height = 400 * H
> > >>           Text1(X).FontSize = Int(14 * W)
> > >>           Text1(X).Visible = True
> > >>           Label1(X + 1).Top = Y
> > >>           Label1(X + 1).FontSize = Int(14 * W)
> > >>           Label1(X + 1).Left = 1500 * W
> > >>           Label1(X + 1).Width = 6400 * W
> > >>           Label1(X + 1).Height = 400 * H
> > >>           Label1(X + 1).Visible = True
> > >>           heatray(X + 1) = 0
> > >>      Next

> > >>      Text1(0).Height = 400 * H    '---- have to reset
> > >>      Text1(0).SetFocus
> > >>      Text1(8).Height = 400 * H    '---- have to reset

> > >>      Text2.Top = 8500 * H
> > >>      Text2.Left = 1650 * W
> > >>      Text2.Width = 8250 * W
> > >>      Text2.Height = 400 * H
> > >>      Text2.FontSize = Int(14 * W)
> > >>      Text2.Visible = False

> > >> End Sub



Tue, 14 Sep 2004 08:27:01 GMT  
 textbox size
Mike,
That is most generous of you to debug someone else's problem. but to be
honest, I don't know how.  I think it is too long to email without zipping
it and I have never zipped anything.  I have of course unzipped things.

I got around to reversing the set font and the set height and it does seem
to work.  Why?  I have NO idea.  Well, that's not true.  It does make sense.
Then again, no it doesn't.  If the others would take the set with them
reversed, why the (heck?) wouldn't the first and the last?  As you can see,
I'm setting each individually in the for next loop so one has absolutely
nothing to do with the other.

Glenn


Quote:
> Its often difficult for people to sort out problems of this nature unless
> they have seen the actual Form you are using. There may be something
> different in the two Text Boxes you mention, or there may be some other
> problem. Email the project to me and I will have a look at it.

> Mike



> > I thank you for all the thoughts and I am sure you old time programmers
> are
> > right in everything listed here...........

> > BUT

> > It DOES set all but the first and last textbox to my requested size and
on
> a
> > second pass even sets those to my request.  Even on the first pass, I
can
> > reassign the two rogue boxes and they behave.  The font seems to set
right
> > because if you noticed, I force the fraction to an integer and Ariel
> accepts
> > about all sizes in that range.

> > I confess I haven't had time to reverse the height and fontsize settings
> yet
> > but in a for next loop, I am setting each array individually.  I am
> > mystified as why all of them accept the setting except the first and
last
> > and they accept it in a separate setting.

> > BTW There must be a better way to adjust everything to a different
screen
> > resolution.  How do you guys do it?

> > See you tomorrow.  Today is our 50th wedding anniversary.

> > Glenn



> > > On Thu, 28 Mar 2002 00:28:02 GMT, "Billy Joe"

> > > >Glenn,

> > > >I get the same results either commenting out setting the Text Box
> height
> > OR not.
> > > >However, the logic only works when width is set after font.  I
believe
> VB
> > scales Text Boxes' height by the font and your resetting
> > > >the height are countermanding its effort? This seems especially true
as
> > fonts do not scale a precisely as lines!
> > > Yup - VB resets the height of a Textbox to something that suits its
> > > Font size.

> > > >If I set width before the font setting, the boxes acquire an extra
> > separation between them and are not scaled.

> > > >Sub again()

> > > >  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> > > >  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> > > >  Form1.Show

> > > >  W = intCurrResX / 1280: H = intCurrResY / 1024

> > > >  'W = 0.62: H = 0.58                '----trial numbers = to 800 X
600

> > > >  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> > > >  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> > > >  Form1.FontSize = Int(14 * W)

> > > >  Y = 500 * H                       '------------set top line
> > > >  For X = 0 To Text1.UBound
> > > >    Y = Y + 500 * H                 '----line increment
> > > >    Text1(X).Top = Y
> > > >    Text1(X).Left = 8000 * W
> > > >    Text1(X).FontSize = Int(14 * W)
> > > >    Text1(X).Width = 1200 * W
> > > >'    Text1(X).Height = 400 * H
> > > >    Text1(X).Visible = True
> > > >  Next
> > > >End Sub

> > > >Private Sub Command_Click()
> > > >  again
> > > >End Sub
> > > >--
> > > >Regards,
> > > >Billy Joe

> > > >B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M



> > > >> I am programming on a 17" - 1280 X 1024 screen and of course forms
> > overlap
> > > >> smaller screens.  This routine seems to work, except.....

> > > >> Everything seems to set right except Text1(0).Height and
> > Text1(8).Height.
> > > >> They come out to the size setup originally in the Properties.  If
you
> > will
> > > >> notice below the for-next routine, I reset those two values again
and
> > they
> > > >> show correctly on the screen.  Nowhere else in the routine are
these
> > values
> > > >> messed with.

> > > >> Another anomaly.   After completing the routine printout, it calls
> 'sub
> > > >> again'  to start over and this time it shows the two rogue
textboxes
> > correct
> > > >> without the reset after the for-next.

> > > >> Can anyone see what I am not?  I even moved Form1.show around to
> > different
> > > >> places (before and after) and that doesn't seem to change anything.

> > > >> Glenn

> > > >> Sub again()

> > > >> intCurrResX = Screen.Width / Screen.TwipsPerPixelX
> > > >> intCurrResY = Screen.Height / Screen.TwipsPerPixelY
> > > >>      Form1.Show

> > > >> REM     W = intCurrResX / 1280: H = intCurrResY / 1024

> > > >>      W = 0.62: H = 0.58 '----trial numbers = to 800 X 600

> > > >>      Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
> > > >>      Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
> > > >>      Form1.FontSize = Int(14 * W)

> > > >>      Y = 500 * H       '------------set top line
> > > >>      For X = 0 To 8
> > > >>           Y = Y + 500 * H     '----line increment
> > > >>           Text1(X).Top = Y
> > > >>           Text1(X).Text = ""
> > > >>           Text1(X).Left = 8000 * W
> > > >>           Text1(X).Width = 1200 * W
> > > >>           Text1(X).Height = 400 * H
> > > >>           Text1(X).FontSize = Int(14 * W)
> > > >>           Text1(X).Visible = True
> > > >>           Label1(X + 1).Top = Y
> > > >>           Label1(X + 1).FontSize = Int(14 * W)
> > > >>           Label1(X + 1).Left = 1500 * W
> > > >>           Label1(X + 1).Width = 6400 * W
> > > >>           Label1(X + 1).Height = 400 * H
> > > >>           Label1(X + 1).Visible = True
> > > >>           heatray(X + 1) = 0
> > > >>      Next

> > > >>      Text1(0).Height = 400 * H    '---- have to reset
> > > >>      Text1(0).SetFocus
> > > >>      Text1(8).Height = 400 * H    '---- have to reset

> > > >>      Text2.Top = 8500 * H
> > > >>      Text2.Left = 1650 * W
> > > >>      Text2.Width = 8250 * W
> > > >>      Text2.Height = 400 * H
> > > >>      Text2.FontSize = Int(14 * W)
> > > >>      Text2.Visible = False

> > > >> End Sub



Tue, 14 Sep 2004 10:45:29 GMT  
 textbox size

Quote:
> 2.  The TextHeight of a font is *not* the same as its font size would
> indicate. It is a small percentage greater than that value. For example,
> using a font of Arial size 12 the point size (12) would seem to indicate
> that the TextHeight is 12 * 20 = 240 Twips. If you ask for the height,
> though, you will get the answer 270.

... or more precisely, textheight includes the actual font height, plus the
space reserved for Internal Leading (space inside the bounds set by the
tmHeight member where accent marks and other diacritical characters may
occur), plus the space reserved for External Leading (space added between
rows).
  --

  Randy Birch
  MVP Visual Basic

http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.



Tue, 14 Sep 2004 12:16:01 GMT  
 textbox size

Quote:

> ... or more precisely, textheight includes the actual font height, plus
the
> space reserved for Internal Leading (space inside the bounds set by the
> tmHeight member where accent marks and other diacritical characters may
> occur), plus the space reserved for External Leading (space added between
> rows).

Very true, Randy. 9 / 10 !

You can make it 10 / 10 if you can tell me the correct pronunciation of
"Leading" :-)

Mike



Tue, 14 Sep 2004 22:40:54 GMT  
 textbox size
Glenn,

apparently your first / last text box is an optical illusion!
In this line below, I staircased your text boxes.  They were overlapping, thus appearing oddly dimensioned to the eye!
      .Left = 8000 * W + (120 * x)  '***************** MODIFIED
All the boxes were/are the same size
as shown in this line:
    ' ************************** ADDED for testing!
      .Caption = "X" & x & " w=" & Text1(x).Width & " h=" & Text1(x).Height

Together with moving this line:
      .Width = 1200 * W           'move this after font adjust
after the font setting and deleting the .Height setting, all is visually correct!
--
Regards,
Billy Joe

B J B 1 9 3 9  A T  H O T M A I L  D O T  C O M

Option Explicit

Private Sub Command1_Click()
  again
End Sub

Sub again()
  'These were undimensioned! BE SURE to use Option Explicit (as above)
  Dim intCurrResX As Single
  Dim intCurrResY As Single
  Dim W As Integer, H As Integer
  Dim y As Integer, x As Integer

  intCurrResX = Screen.Width / Screen.TwipsPerPixelX
  intCurrResY = Screen.Height / Screen.TwipsPerPixelY
  Form1.Show

 W = intCurrResX / 1280: H = intCurrResY / 1024

Rem  W = 0.62: H = 0.58                '----trial numbers = to 800 X 600

  Form1.Width = intCurrResX * Screen.TwipsPerPixelX * W
  Form1.Height = intCurrResY * Screen.TwipsPerPixelY * H
  Form1.FontSize = Int(14 * W)

  y = 500 * H                       '------------set top line
  For x = 0 To Text1.ubound
    y = y + 500 * H                 '----line increment
    With Text1(x)
      .Top = y
      '.Text = ""
      .Left = 8000 * W + (120 * x)  '***************** MODIFIED
'      .Height = 400 * H          'remove this
      .Width = 1200 * W           'move this after font adjust
      .FontSize = Int(14 * W)
      .Visible = True
    End With
    With Label1(x + 1)
      .Top = y
      .FontSize = Int(14 * W)
      .Left = 1500 * W
      .Width = 6400 * W
      .Height = 400 * H
      .Visible = True
    ' ************************** ADDED for testing!
      .Caption = "X" & x & " w=" & Text1(x).Width & " h=" & Text1(x).Height
    End With
  Next

'  Text1(0).Height = 400 * H         '---- have to reset
'  Text1(0).SetFocus
'  Text1(8).Height = 400 * H         '---- have to reset

  Text2.Top = 8500 * H
  Text2.Left = 1650 * W
  Text2.Width = 8250 * W
  Text2.Height = 400 * H
  Text2.FontSize = Int(14 * W)
  'Text2.Visible = False

End Sub

<snip>



Wed, 15 Sep 2004 01:54:21 GMT  
 textbox size
Lead, as in the metal, originally named due to the use of lead blocks as
spacers in typography. Not lead as in "in front".

--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


Quote:


> > ... or more precisely, textheight includes the actual font height, plus
> the
> > space reserved for Internal Leading (space inside the bounds set by the
> > tmHeight member where accent marks and other diacritical characters may
> > occur), plus the space reserved for External Leading (space added
between
> > rows).

> Very true, Randy. 9 / 10 !

> You can make it 10 / 10 if you can tell me the correct pronunciation of
> "Leading" :-)

> Mike



Wed, 15 Sep 2004 05:27:07 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Multiple Text lines with text wrap to fit the textbox size

2. Changing a TextBox size.

3. TextBox Size Dynamic

4. font and textbox size

5. TextBox size

6. String Size Limit in Textbox and Listbox

7. Why the TextBox.Font.size is readonly?

8. How to figure out the required size of a TextBox for a text

9. textbox field size limit

10. Sizing TextBox

11. help changing textbox tab size

12. Changing size of TextBox

 

 
Powered by phpBB® Forum Software