Automatically Reposition or Resize Controls Upon Form Resize

Category:
Forms and Controls
Type:
Classes
Difficulty:
Intermediate
Author:
neophile

Version Compatibility: Visual Basic 6

More information:
If any of you have ever used Delphi, I'm sure you appreciated the Anchor properties given to controls. For those who are not familiar with the Anchors in Delphi, they allow you to Anchor the Edges of controls to the right or bottom edge of a form. So when the form resizes, the Left/Width and/or Top/Height properties automatically adjust. Here are three classes that do something pretty similar, only at runtime. I've also included a sample projct to demonstrate their use. The classes could use some improvement, mostly involving subclassing, but I thought I'd start simple. I hope you find this useful. =)

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download anchorsample.zip