Hi there,
Anybody have any good ideas for resizing Windows controls when the user resizes the main window?
For example, say we have a hex calculator, where we have the digits 0 to 9 and also a row of
buttons on the bottom A, B, C, D, E, F, for the upper hex digits.
When we resize the window on the right side (we want to make it wider) the buttons should get proportionally larger.
The problem is, this works out good mathematically:
button widths of 20 pixels each turn into 40 pixels each if the window is made twice as wide
and turn into 30 pixels each if the window is made 3/2 times wider, but when the division does not result in an integer it gets kind of strange because there is also spacing that might need to change.
For example, starting at 50 pixels wide each, if we resize the main window from 500 to 510 each button has to be made 51 pixels wide each, but if we resize the main window from 500 to 505 then each button has to be made 50.5 pixels wide each, which is not possible.
If we make them 51 pixels each, then we end up with an extra 3 pixels with no place to put them without increasing something.
If we keep them at 50 each, then we havent changed anything, so that would mean the window would get 5 pixels wider but the buttons would not change. I guess that may be the only option but would be interested to hear with others have to say about this.
The control resize scheme will get even hairier if the controls are not all of the same size, which is entirely possible and even likely.
I could show some screen shots to illustrate.
Anybody have any good ideas for resizing Windows controls when the user resizes the main window?
For example, say we have a hex calculator, where we have the digits 0 to 9 and also a row of
buttons on the bottom A, B, C, D, E, F, for the upper hex digits.
When we resize the window on the right side (we want to make it wider) the buttons should get proportionally larger.
The problem is, this works out good mathematically:
button widths of 20 pixels each turn into 40 pixels each if the window is made twice as wide
and turn into 30 pixels each if the window is made 3/2 times wider, but when the division does not result in an integer it gets kind of strange because there is also spacing that might need to change.
For example, starting at 50 pixels wide each, if we resize the main window from 500 to 510 each button has to be made 51 pixels wide each, but if we resize the main window from 500 to 505 then each button has to be made 50.5 pixels wide each, which is not possible.
If we make them 51 pixels each, then we end up with an extra 3 pixels with no place to put them without increasing something.
If we keep them at 50 each, then we havent changed anything, so that would mean the window would get 5 pixels wider but the buttons would not change. I guess that may be the only option but would be interested to hear with others have to say about this.
The control resize scheme will get even hairier if the controls are not all of the same size, which is entirely possible and even likely.
I could show some screen shots to illustrate.