# Geometry Manager

J. Landman Gay jacque at hyperactivesw.com
Fri Aug 31 14:54:04 EDT 2012

```On 8/31/12 12:41 PM, Peter Haworth wrote:
> I'll write my
> own resize stack handler to take care of it.
>
> Any pointers as to good techniques to do this?  I have 1 control that needs
> to be scaled horizontally and vertically and a couple of others that need
> to be re-positioned.

With only three controls it should be easy. The basic idea is to just go
through everything that needs changing, calculate either the new
rectangle or the new location, and set it. It's purely grunt work,
tedious but not hard.

For the most flexibility, use ratios when resizing. I usually figure out
what the ratio is for a control in my original layout and then use that
for the calcuation. I.e., if a field should be a third of the vertical
size of the card, then the ratio is .33. Multiply the card height by .33
and put appropriate values into the other three points of the rectangle;
then set the rect. It all depends on your layout. Sometimes the width
will remain constant, sometimes not. Sometimes you always want the left
at 0, sometimes not.

Repositioning works similarly. You can either change the topleft, or the
location, or some other point, or you can use a ratio to calculate the
new position (one-third of the way from top, for example) and set the
topleft to that. Or set the left to the left of another object, or use
any other reference that should line up.

I suppose that's vague enough to confuse. :)

--
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

```