When I use ReSize in a UserControl that contains an SSTab my program crashes

Last updated: January 21, 2007

Cause: This is due to the fact that ReSize needs to read the ScaleWidth and ScaleHeight properties from the main container. Prior to VB5 the main container was always a form, but now in the case of a VB generated OCX it can also be a UserControl. Forms always expose the ScaleWidth and Scaleheight properties, but UserControls may or may not do this.

Remedy: The solution for now is to simply expose the ScaleWidth and ScaleHeight properties of the user control. You can do this by adding the following 6 lines of code to the user control.

Public Property Get ScaleHeight() As Single
    ScaleHeight = UserControl.ScaleHeight
End Property

Public Property Get ScaleWidth() As Single
    ScaleWidth = UserControl.ScaleWidth
End Property

In the future we may be able to make ReSize smarter so that when it is dealing with a user control that does not have a ScaleWidth or ScaleHeight exposed it just goes for the Width and Height. Until then this work around should do the job.

Copyright © 2007 by Larcom and Young.
All rights reserved. Revised: January 21, 2007.