Height of Controls

  • Thread starter Thread starter vovan
  • Start date Start date
V

vovan

I need to place many controls on the form - Textboxes, DateTimePickers,
Combos.
I'd like to line up them and put them as close as possible in the vertical
direction. But due to different default heights of different controls
(Textbox.Height = 20, Combobox.Height =21) I cannot do it.

What properties of controls do I have to set first to allow to set the same
heights for controls?

Thank you

vovan
 
Vovan,

In the options you can set the used pixels of your IDE, probably this will
be the way to reach your goal.

Don't ask me where exact I never do this, I keep the let say standard
distance between boxes, I don't want to be hated by the end users.

Cor
 
I need to place many controls on the form - Textboxes, DateTimePickers,
Combos.
I'd like to line up them and put them as close as possible in the vertical
direction. But due to different default heights of different controls
(Textbox.Height = 20, Combobox.Height =21) I cannot do it.

What properties of controls do I have to set first to allow to set the same
heights for controls?

Thank you

vovan

Vovan,
If you're adding controls at runtime(because design mode you just drag
and release objects to place), I think you must look at location
property rather than size. Because you want to line up control in a
vertical order, so each control's bottom means another control's top
in that order. So, in that case you must set Y coordinate of location
point of each control.

HTH,

Onur
 
I need to have controls on the form located in 2 virtual columns and many
virtual rows.
Let's assume that in the first row I have 2 textboxes. So far everything's
OK - their top and bottom properties are the same. I'm adding another row of
controls - 2 textboxes. The distance bitween the bottom of the controls in
the first row and top of the controls of the second row is the same. - Good.
I add a third row with one textbox and 1 combo. Then the 4th row with
controls. Now I have different space between the third and fourth row
controls.
And I wouldn't want to have it.

Thank you
 
vovan said:
I need to have controls on the form located in 2 virtual columns and
many virtual rows.
Let's assume that in the first row I have 2 textboxes. So far
everything's OK - their top and bottom properties are the same. I'm
adding another row of controls - 2 textboxes. The distance bitween
the bottom of the controls in the first row and top of the controls
of the second row is the same. - Good. I add a third row with one
textbox and 1 combo. Then the 4th row with controls. Now I have
different space between the third and fourth row controls.
And I wouldn't want to have it.

After adding one row, use the height of the largest control in the row
to calculate the top of the next row.


Armin
 
Armin Zingler said:
After adding one row, use the height of the largest control in the row to
calculate the top of the next row.


Armin

You can use the TableLayout control. Each time you want to add a new row
there is a method for that and then you add the controls. It is a good way
to keep the tops correct.

LS
 
Vovan,

If you want it you can inherit all controls to build your own and paint by
instance a nice thick border around those which are in your idea to small.

Cor
 
Lloyd Sheen said:
You can use the TableLayout control. Each time you want to add a new
row there is a method for that and then you add the controls. It is a
good way to keep the tops correct.

Yes, right, I forgot that. There are so many ways and components
nowadays that I do not consider them all sometimes. :-)


Armin
 
Back
Top