How do I use ReSize with FarPoint's Tab Pro control?

Last updated: January 21, 2007

It is possible make ReSize work with the FarPoint Tab Pro control, but you must write a few lines of code. The trick is to let the Tab Pro and the ReSize control share the job of moving and sizing controls.

1. Set the AutoSizeChildren property of the Tab Pro control to 3-Both (Size and Position).

2. For each first generation child control that you place on the tab (a child of a frame would be second generation) place code in the PreResize event of the ReSize control to ignore the resizing of that control.

Option 1.

Private Sub ReSize1_PreResize(ControlName As String,
    ControlType As String, NewTop As Single,
    NewLeft As Single, NewHeight As Single,
    NewWidth As Single, NewFontSize As Single,
    IgnoreControl As Boolean, ByVal CurrentControl As Object)

    If ControlName = "Command2" Then
        IgnoreControl = True
    End If

End Sub

You could also write If ControlName = "Command1" OR ControlName = "Command2" above.

This works pretty good except the FarPoint control is not smart enough to resize the fonts of the first generation controls that it is handling.

Option 2.

Private Sub ReSize1_PreResize(ControlName As String,
    ControlType As String, NewTop As Single,
    NewLeft As Single, NewHeight As Single,
    NewWidth As Single, NewFontSize As Single,
    IgnoreControl As Boolean, ByVal CurrentControl As Object)

    If ControlName = "Command1" OR ControlName = "Command2" Then
        NewLeft = CurrentControl.Left
        NewTop = CurrentControl.Top
        NewWidth = CurrentControl.Width
        NewHeight = CurrentControl.Height
    End If
End Sub

The above is better because now the fonts of the first generation children of the tab will also be sized (by ReSize).

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