[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1011
  • Last Modified:

resize forms in vb6.0

Hi there,

I need an understanding on how to resize forms in vb6.0. I understand the min and max atributes but i need to know how to go about having my content in the forms stretch or resize to fit the size window instead of having a large window but all my content being the same size in the top left hand corner.

Im looking for the coding logic for going about doing this.

Thanks in advanced.
  • 2
2 Solutions
Check out the code in this example. It should give you an idea on how to resize the controls and objects.

Basically there is no easy way to do this in VB6.
But essentially this is what happens.

Any time a form is resized (i.e., your application), the "form_resize" event is called.
To get the 'new' dimensions of your form, you would have form1.width and form1.height.

Based on that new information, you simply figure out how the controls within your form
should be resized. For example, say you had a text box that you wanted to be the size
of the form. Then you would have

private sub form_resize()

formWidth = form1.width
formHeight = form1.height

myTextBox.width = formWidth
myTextBox.height = formHeight

end sub

Of course, if you had other controls (i.e., other text boxes), you would decide how they should
be resized in relation to each other. I.e., is text box #2 always to the right of textbox #1? If
so, then you would say textBox2.left = textBox1.width + textBox1.left (so textBox2 takes into
account textBox1's starting location (the 'left' part), and then plus its width).

You basically have to play around with it to get it the way you like it.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now