views:

42

answers:

3

Is there any way to have textual content of controls on a TableLayoutPanel align themselves properly? I've got labels in column 0, and textboxes (or occasionally ComboBox or NumericUpDown controls) in column 1, but the text in the label is usually a pixel or two out (vertically) on most rows.

A: 

Oh, you mean that text baseline for label is different than for other controls? If so, try to remove vertical anchors. You may play with margins as well.

Paweł Dyda
Tried that, but it doesn't work with everything; Comboboxes are still badly aligned.
Flynn1179
A: 

What I usually do is put them in a container eg a panel and anchor them relatively to that. The advantages of adding a container is you can also reduce the no of Win handlers. In that case that wouldn't matter , because you already have the TablelayoutPanel so basically for all the controls you only have a single handler.

MadalinaA
A: 

You can set following properties:

for Label
1.Autosize= false;
2.TextAlign= MiddleLeft;

for Controls like Combobox,Textbox

goto View -> Toolbars -> Layout

Now you can give layout of your controls very easily by the Toolbar by selecting Multiple Controls at a Time............

Javed Akram