ACC2: How to Dynamically Size Forms to Fit Screen ResolutionID: Q138901
|
Moderate: Requires basic macro, coding, and interoperability skills.
Microsoft Access provides no built in support to scale a form's size to
match the current screen resolution. A form that you design on a computer
with a video driver resolution of 1024x768 (Super VGA) may appear too large
on computers running at 640x480 (VGA) resolution. A form that you design
using 640x480 resolution may appear too small on computers running at
1024x768 resolution.
The following information describes where you can obtain two Access Basic
functions, glrScaleForm() and glrResizeForm(), that you can use to
dynamically scale and size a form. The glrScaleForm() function can be
called from the Open event of your form to scale the size of a form to the
current screen resolution when the form loads. The glrResizeForm() can be
called from the Resize event of the form to automatically move and size the
contents of a form proportionally to fit the new dimensions of the form
window.
Syntax:
Function glrScaleForm (frm As Form, intX As Integer, intY As Integer)
frm: form to be scaled
intX: horizontal resolution at which the form was designed
intY: vertical resolution at which the form was designed
Example:
Sub Form_Open (Cancel As Integer)
Dim RetVal
RetVal = glrScaleForm(Me, 1024, 768)
End Sub
Syntax:
Function glrResizeForm (frm As Form, fDoResize As Variant)
frm: form to resized
fDoResize: boolean value indicating if the form should be resized or
the information tracked
Example:
Sub Form_Resize ()
Dim RetVal
RetVal = glrResizeForm(Me, True)
End Sub
Microsoft Access 2 Developer's Handbook. Ken Getz, Paul Litwin,
Greg Reddick. Sybex: 1994 ISBN: 0-7821-1327-3
"Create Resolution-Independent Forms in Access 2.0" by Ken Getz
Smart Access, June 1994
Pinnacle Publishing, Inc.
18000 72nd Ave South, Suite 217
Kent, WA 98032
800-788-1900
Additional query words:
Keywords : kb3rdparty FmsHowto
Version : WINDOWS:2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 14, 1999