List, Combo and Text Boxes Won't Line Up 
Author Message
 List, Combo and Text Boxes Won't Line Up

In code, set the left and/or top properties to the same value to cause
alignment. You can also do this in design mode with the property window. Or,
use the Format...Align menu item from the IDE (at least in VB6 - I think VB5
has it also).


Quote:
> Using VB5

> I've struggled with this problem since I started  using VB.  I can
> never get list box, combo box and text box frames to line up properly.

> Early on, I concluded it was because list and combo boxes have
> discrete heights steps, while text boxes don't -- for some weird
> reason.  Struggling with this problem again today it dawned on me it
> may just be me doing something wrong.

> Is there an inate problem lining up object frames in VB?

> jim
> ___
> Have a home upkeep question?  Try my help page.  It's sort of an

alt.home.repair FAQ.   http://www.*-*-*.com/


Thu, 14 Feb 2002 03:00:00 GMT  
 List, Combo and Text Boxes Won't Line Up
Jim, you're right, it's very annoying. They're simply not exactly the same
height. Even if you 'align to grid', they look a little 'off' next to each
other.  Another facet of it is the fact that label text doesn't really line
up with the text in an adjacent textbox, etc.!

Quote:

>I can align the tops (or bottoms, I suppose) but, since the list box
>increase in height in discrete steps and the combo box height is fixed
>you can't make them any height you'd like so, you can't force the
>bottoms to come out aligned.

>You can illustrate this for yourself by creating a form and putting a
>list box and a text box on it.  Just accept the default sizes and {*filter*}
>them together side-by-side with the tops aligned.  You will see that
>one is longer than the other.  Now go to the properties box and try to
>change the list box height to equal the text box height.  It won't let
>you.  Make any small change to the list box height and it will jump
>back to what it was.  This is what I mean by changing in discrete
>steps.

>You can change the text box height to match the list box but, that's
>only useful if you never resize the form.

>jim

>On Sun, 29 Aug 1999 19:34:59 -0700, "Eric L. Lundstrom"

>>In code, set the left and/or top properties to the same value to cause
>>alignment. You can also do this in design mode with the property window.
Or,
>>use the Format...Align menu item from the IDE (at least in VB6 - I think
VB5
>>has it also).



>>> Using VB5

>>> I've struggled with this problem since I started  using VB.  I can
>>> never get list box, combo box and text box frames to line up properly.

>>> Early on, I concluded it was because list and combo boxes have
>>> discrete heights steps, while text boxes don't -- for some weird
>>> reason.  Struggling with this problem again today it dawned on me it
>>> may just be me doing something wrong.

>>> Is there an inate problem lining up object frames in VB?

>jim
>___
>Have a home upkeep question?  Try my help page.  It's sort of an

alt.home.repair FAQ.   http://www.*-*-*.com/


Fri, 15 Feb 2002 03:00:00 GMT  
 List, Combo and Text Boxes Won't Line Up
It is because VB (by default) causes the List Box height to be adjusted in
discreet steps so that it displays complete lines of text (the size of the
steps is determined by the size of the font). The height will go to the
nearest discreet value irrespective of whether you set it at design time or
in code.

You can change this behaviour (and make the height anything you like) by
setting the Listbox IntegralHeight property to False (you can only do this
at design time).

Personally, I think that having discreet steps is a good idea. I don't like
parts of a line being displayed. If you want to leave it this way then when
you need to resize things you can set the List Box height - then read it
again (to see what height it actually went to) and then make the text box
the same height. (You should use the same font in both).

Mike


Quote:
> I can align the tops (or bottoms, I suppose) but, since the list box
> increase in height in discrete steps and the combo box height is fixed
> you can't make them any height you'd like so, you can't force the
> bottoms to come out aligned.

> You can illustrate this for yourself by creating a form and putting a
> list box and a text box on it.  Just accept the default sizes and {*filter*}
> them together side-by-side with the tops aligned.  You will see that
> one is longer than the other.  Now go to the properties box and try to
> change the list box height to equal the text box height.  It won't let
> you.  Make any small change to the list box height and it will jump
> back to what it was.  This is what I mean by changing in discrete
> steps.

> You can change the text box height to match the list box but, that's
> only useful if you never resize the form.

> jim

> On Sun, 29 Aug 1999 19:34:59 -0700, "Eric L. Lundstrom"

> >In code, set the left and/or top properties to the same value to cause
> >alignment. You can also do this in design mode with the property window.
Or,
> >use the Format...Align menu item from the IDE (at least in VB6 - I think
VB5
> >has it also).



> >> Using VB5

> >> I've struggled with this problem since I started  using VB.  I can
> >> never get list box, combo box and text box frames to line up properly.

> >> Early on, I concluded it was because list and combo boxes have
> >> discrete heights steps, while text boxes don't -- for some weird
> >> reason.  Struggling with this problem again today it dawned on me it
> >> may just be me doing something wrong.

> >> Is there an inate problem lining up object frames in VB?

> jim
> ___
> Have a home upkeep question?  Try my help page.  It's sort of an

alt.home.repair FAQ.   http://www.*-*-*.com/


Fri, 15 Feb 2002 03:00:00 GMT  
 List, Combo and Text Boxes Won't Line Up
FYI, the format rectangle of a textbox can be set using SendMessage (EM_SETRECT).
It should be possible to line up the text in a textbox, with that contained a label.

It may also be possible to change the Listbox style so that it can be any height
(LBS_NOINTEGRALHEIGHT).

I have successfully changed the format rectangle of a textbox (to give me more
left margin), I have not however, tried changing the list box....

HTH
LFS

Quote:

> Jim, you're right, it's very annoying. They're simply not exactly the same
> height. Even if you 'align to grid', they look a little 'off' next to each
> other.  Another facet of it is the fact that label text doesn't really line
> up with the text in an adjacent textbox, etc.!


> >I can align the tops (or bottoms, I suppose) but, since the list box
> >increase in height in discrete steps and the combo box height is fixed
> >you can't make them any height you'd like so, you can't force the
> >bottoms to come out aligned.

> >You can illustrate this for yourself by creating a form and putting a
> >list box and a text box on it.  Just accept the default sizes and {*filter*}
> >them together side-by-side with the tops aligned.  You will see that
> >one is longer than the other.  Now go to the properties box and try to
> >change the list box height to equal the text box height.  It won't let
> >you.  Make any small change to the list box height and it will jump
> >back to what it was.  This is what I mean by changing in discrete
> >steps.

> >You can change the text box height to match the list box but, that's
> >only useful if you never resize the form.

> >jim

> >On Sun, 29 Aug 1999 19:34:59 -0700, "Eric L. Lundstrom"

> >>In code, set the left and/or top properties to the same value to cause
> >>alignment. You can also do this in design mode with the property window.
> Or,
> >>use the Format...Align menu item from the IDE (at least in VB6 - I think
> VB5
> >>has it also).



> >>> Using VB5

> >>> I've struggled with this problem since I started  using VB.  I can
> >>> never get list box, combo box and text box frames to line up properly.

> >>> Early on, I concluded it was because list and combo boxes have
> >>> discrete heights steps, while text boxes don't -- for some weird
> >>> reason.  Struggling with this problem again today it dawned on me it
> >>> may just be me doing something wrong.

> >>> Is there an inate problem lining up object frames in VB?

> >jim
> >___
> >Have a home upkeep question?  Try my help page.  It's sort of an
> alt.home.repair FAQ.   http://www.*-*-*.com/



Fri, 15 Feb 2002 03:00:00 GMT  
 List, Combo and Text Boxes Won't Line Up
If you want to make the ListBox the same height as the TextBox *without*
concern for how the displayed text may be cut off by at the bottom, set the
IntegralHeight property of the ListBox to False in the property window or
issue this command:

     List1.IntegralHeight = False

You now can issue the following:

      List1.Height = Text1.Height

and they will be the same height.

Rick


Quote:
> Jim, you're right, it's very annoying. They're simply not exactly the same
> height. Even if you 'align to grid', they look a little 'off' next to each
> other.  Another facet of it is the fact that label text doesn't really
line
> up with the text in an adjacent textbox, etc.!


> >I can align the tops (or bottoms, I suppose) but, since the list box
> >increase in height in discrete steps and the combo box height is fixed
> >you can't make them any height you'd like so, you can't force the
> >bottoms to come out aligned.

> >You can illustrate this for yourself by creating a form and putting a
> >list box and a text box on it.  Just accept the default sizes and {*filter*}
> >them together side-by-side with the tops aligned.  You will see that
> >one is longer than the other.  Now go to the properties box and try to
> >change the list box height to equal the text box height.  It won't let
> >you.  Make any small change to the list box height and it will jump
> >back to what it was.  This is what I mean by changing in discrete
> >steps.

> >You can change the text box height to match the list box but, that's
> >only useful if you never resize the form.

> >jim

> >On Sun, 29 Aug 1999 19:34:59 -0700, "Eric L. Lundstrom"

> >>In code, set the left and/or top properties to the same value to cause
> >>alignment. You can also do this in design mode with the property window.
> Or,
> >>use the Format...Align menu item from the IDE (at least in VB6 - I think
> VB5
> >>has it also).



> >>> Using VB5

> >>> I've struggled with this problem since I started  using VB.  I can
> >>> never get list box, combo box and text box frames to line up properly.

> >>> Early on, I concluded it was because list and combo boxes have
> >>> discrete heights steps, while text boxes don't -- for some weird
> >>> reason.  Struggling with this problem again today it dawned on me it
> >>> may just be me doing something wrong.

> >>> Is there an inate problem lining up object frames in VB?

> >jim
> >___
> >Have a home upkeep question?  Try my help page.  It's sort of an
> alt.home.repair FAQ.   http://www.*-*-*.com/



Fri, 15 Feb 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Limiting Access to Text Boxes, List Boxes and Combo Boxes

2. Converting lines in a text box to items in a combo box

3. Bold text on certain items in a combo box / list box

4. Can't get Combo Box selection into Text Box

5. Save Text Boxes Values To Combo Box's Item

6. Text won't fit in text box

7. text box text won't change

8. How to list macro names in a combo box or a list box

9. Bound combo box won't let be cancel/undo, continually generating error messages

10. Combo Box won't dropdown on form open

11. Combo box won't update

12. Combo Box won't Change

 

 
Powered by phpBB® Forum Software