Rescaling Forms with Access Developer's Handbook

F

Fuzzer

Hello all,

I've been trying to chase down some issues I had with resizing and
rescaling forms and was using the code from the Access Desktop
Developer's Handbook 2002. As many others had already discovered, the
bottom or right edges will sometimes appear to get chopped off the
form. After thoroughly studying the code and going line by line, I
believe that I have a workaround for this that I would like to share.
Let me know what you think and if there is another area that would work
even better.

Below are the settings that I changed by adding an offset to the
scalling factors. I believe that after so many conversions and
flipping between pixels and twips, a bit of an error in size is
induced. I found that by increasing the size of the form and window
with an offset ( by decreasing the scale factor), I was able to let the
controls get resized while still retaining the correct form/window size
for my needs.

The offset for the rescale form procedure is used to increase the
amount of scaling done to the controls. I had a form with LOTS of
controls all the way to the edges and found that a setting of .83
worked great so I did not have to redesign my entire form, as I was
about to have to do.

I've hard coded the .83 for now to test, but am making it a setting
that will be used only for specific resolutions that I'll set at the
beginning, in this case 800X600 would get the offset of .83. At the
design setting of 1024X768 .83 adds way too much gutter space and
shrinks the controls too much for the forms size, .95 was acceptable
however.

Also, there's a little more work to be done so the center procedure
works correctly, but at least this is a step to assist anyone else
looking for some workarounds.

Enjoy and happy computing!

And thank you Mr Getz for such excellent code in the first place. So
much of it is still beyond me, but I'll learn all I can!

The following sections wIthin the FormResize class need to be altered:

RescaleForm:

decFactorX = CDec((lngWidth / (mrct.Right - mrct.Left) * 0.95))
decFactorY = CDec((lngHeight / (mrct.Bottom - mrct.Top) * 0.95))

MoveForm:

intWidth = Int((.Right - .Left) * decFactorX * 1.2)
intHeight = Int((.Bottom - .Top) * decFactorY * 1.2)

FixSections:

..Section(i).Height = _
Min(RoundWhole(CDec(mcolSections("S" & i).Height *
decFactorY * 1.2)), adhcMaxTwips)

SetFormCoords:

frm.Width = Min(RoundWhole(mlngWidthInTwips * decFactorX * 1.2),
adhcMaxTwips)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top