The simple option is to allow the users the ability to maximize your form, which will cause it to fill the entire screen, regardless of their computer's current resolution settings.
The only problem with this approach is that it won't stretch/resize the controls on your form to match its new size. The layout will look the same as it did before, but now it will be crammed into the upper-left corner, with a vast expanse of empty space below and to the right of it. So the trick is dynamically resizing the controls on your form whenever the form itself changes size.
Unfortunately, VB 6 doesn't have any built-in support for this. You have no choice but to write the code to handle resizing all of your controls yourself. The best place to do this is your form's Resize
event. You can determine the current size of your form by checking its ScaleWidth
and ScaleHeight
properties. Each of your controls expose a similar Width
and Height
property that you can use to set their sizes, relative to the size of their container form. You'll need to devise some rudimentary mathematical logic to determine the sizes. A quick Google search should turn up several examples of how others have done this, but there's no shining model available.
One example can be found in e-mail programs like Microsoft Outlook. You might have a TreeView
that takes up 100% of the form's height, but only 50% of its width; a ListView
that takes up 50% of the form's height and 50% of its width; and a TextBox
positioned under that taking up 50% of the form's height and 50% of its width. That would produce a fluid layout similar to that shown below:
--------------------------------
| | |
| | |
| | ListView |
| | |
| | |
| TreeView |---------------|
| | |
| | |
| | TextBox |
| | |
| | |
--------------------------------