Every time a form is resized, a "Hey, You are resizing" event is sent to that form by windows. In VB6 we get a chance to do something with that event by using the Form_Resize event handler template provided by VB6.
You can add this template to your form by selecting it from the procedure dropdown when the object dropdown is set to the form when you are in the Code view of your form. You understand all that, I presume?
Okay - once you have the template, any code in that method will run every time the form is resized.
Here is a very simple example:
Code:
Private Sub Form_Resize()
On Error Resume Next
Text1.Move 50, 50, Me.ScaleWidth - 100, Me.ScaleHeight - 100
End Sub
The above code assumes you have a textbox named text1 on your form. It will essentially "fill" the form with the text1 textbox leaving a 50 twips border all around it. Of course, this is assuming that the forms ScaleMode is set to twips, which is the default. A Twip is a measurement using in lead type printing, and there are 1440 twips per inch. As you resize your form, the textbox will resize as well.
For complex forms with lots of controls it can become very complex to resize all the controls as required. It can be done, of course, but it takes a lot of experience to make this work well. I have a set of classes that I use to wrap all the code for every control on the form, including features for doing splitters, and docking. Luckily, the .NET code for doing the common resizing features is much easier.
Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems