Thursday, February 10, 2005

Aligning controls in the IDE

IDEs allow you to group controls and set layouts - align left edges, align top edges etc. But, if a controls are within different containers, they can't be aligned. The form is a container, so if you have a textbox in a container you can't align it to a textbox on the form. In fact, you can't usually select two controls which aren't in the same container, which is probably the cause of the problem.

So the controls need to be aligned manually - you can add together the various borderwidths and control positions to arrive at a figure, or do it by eye. The former is too much trouble, and the latter is problematic as the controls will be separated by formspace.

I was swearing about this the other day when Robin gave me an answer: he suggested moving the control to be aligned until it overlaps with the target control, after which it is trivial to visually align the controls, at which point the aligned control can be returned to it's proper position on the form using the arrow keys or the appropriate positioning properties.

1 comment:

Anonymous said...

That Robin really is a fantastic chap isn't he.

Formspace, yes, I like it.