How do I redraw the form after clicking the Maximize button?

In VB6, I created a form with some text boxes, lists and commands. I have set the XY positions of all these controls using something like

control2.Top = form.Height * 0.50   'sets the Y-position
control2.Left = form.Width * 0.35   'sets the X-position

control3.Top = form.Height * 0.50
control3.Left = form.Width * 0.45

      

However, when I click the Maximize button of my application, all of the controls remain in the same place, but have moved slightly to the top-left corner of the form. In the meantime, clicking on Maximize also creates a lot of free space in the bottom right corner of the form.

How do I make it so that clicking the Maximize button (the one that looks like an empty square in the upper right corner) tells my program that the form. Height and shape. The weight has changed and that everything should be redrawn?

Or, is there any other way to do this to prevent all of my controls from shifting to the top left corner and to avoid creating a new white space in the bottom right corner? Thanks in advance for your help.

+3


source to share


1 answer


Your form has a Resize event. This event is fired every time the form changes.



Private Sub Form_Resize()
    'Insert your code here
End Sub

      

+9


source







All Articles