Question

In VB6 I created a form with some textboxes, listboxes, and command buttons on it. I set the X-Y positions of all of 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 on the Maximize button of my app all of the controls stay in the same place, but shifted a little more towards the upper left corner of the form. In the meantime, clicking on Maximize also creates a lot of blank space towards the lower right corner of the form.

How do I make it so that clicking on the Maximize button (the one that looks like an empty square in the upper right corner) informs my program that the form.Height and form.Weight has changed and that everything needs to be redrawn?

Or, is there is another way to do this such that we eliminate the shifting of all of my controls towards the upper left corner and eliminate the creation of new, blank space towards the lower right corner? Thanks in advance for your help.

Était-ce utile?

La solution

Your form has an event called "Resize". That event is triggered every time the form resizes.

Private Sub Form_Resize()
    'Insert your code here
End Sub
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top