Create an Expanding Dialog
Problem
You have a dialog with a lot of options, most of which are needed only in specific situations. You’d like to create this form as an expanding dialog, similar to forms that have an Advanced button revealing more options. How can you do this with your own form?
Technique
You can make a hidden section of the form become visible at runtime, and use the Window → Size to Fit Form command to force the form to expand to fit its new dimensions. This solution shows you how to create this type of form using an expanding form footer. You’ll also learn how to minimize screen flashing while resizing the form by manipulating the form’s Painting property.
Follow these steps to create your own expanding dialog form:
Create a new form. To make the form look like a dialog, set the properties of the form as shown in Table 9-6. Some of these property settings are optional, since the expanding technique will work with non-dialog forms too. The settings for the DefaultView and AutoResize properties are required.
Table 9-6. Property settings for a dialog form
Property
Value
DefaultView
Single Form
ScrollBars
Neither
RecordSelectors
No
NavigationButtons
No
AutoResize
Yes
AutoCenter
Yes
PopUp
Yes
Modal
Yes
BorderStyle
Dialog
MinMaxButtons
None
Select View → Form Header/Footer to add a footer section to the form. Set the Visible property of the footer section to No. Because you’re interested in only the footer section, you may wish to ...
Get Access Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.