Visual Basic User's Guide > Creating a Simple Word Processor
The following is involved in order to make the Text Control resize properly when the main window is resized.
Open the code window for the form that contains the Text Control. In the combo boxes on top of the code window, select Form in the Object: box and Resize in the Proc: box. The code window should show an empty procedure for the Resize event:
[Visual Basic 6] Private Sub Form_Resize () End Sub
Extend it as follows:
[Visual Basic 6] Private Sub Form_Resize () TXTextControl1.Left = TXRuler2.Width TXTextControl1.Top = TXButtonBar1.Height + TXRuler1.Height TXTextControl1.Height = ScaleHeight - TXButtonBar1.Height _ - TXRuler1.Height - TXStatusBar1.Height TXTextControl1.Width = ScaleWidth - TXRuler2.Width End Sub
These lines of code will cause the Text Control's position, width and height to be adjusted every time the size of the form is altered. (The '_' character is used to extend one logical line of code to two or more physical lines).