by Rejean Cloutier (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Tue 20th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Resizing Controls at run-time
API Declarations
Private lPrevHeight As Long
Private Sub Form_Resize()
Dim lLenTemp As Long
If lPrevWidth > 0 And lPrevHeight > 0 Then
' Checking Width property
lLenTemp = Label1.Width + (Me.Width - lPrevWidth)
If lLenTemp > 0 And lLenTemp <> Label1.Width Then
Label1.Width = lLenTemp
End If
' Checking Height property
lLenTemp = Label1.Height + (Me.Height - lPrevHeight)
If lLenTemp > 0 And lLenTemp <> Label1.Height Then
Label1.Height = lLenTemp
End If
End If
lPrevWidth = Me.Width
lPrevHeight = Me.Height
End Sub