I want a form to always keep the same Width/Height ratio when it is resized by the end-user, for example twice as wide as height.
Here is what I have written :
Private Sub Form_Resize()
Dim H&, W&
Static OldWidth&, OldHeight&, DoNoChange As Boolean
'DoNoChange is used to avoid recurse process called from inside the Form_Load event
If DoNoChange Then Exit Sub
W = Width: H = Height
If W <> OldWidth Then
H = W /2: If Height <> H Then DoNoChange = True: Height = H: DoNoChange = False
ElseIf H <> OldHeight Then
W = H *2: If Width <> W Then DoNoChange = True: Width = W: DoNoChange = False
OldWidth = Width
OldHeight = Height
1> It works well when the form is resized by dragging its left border but not well when one drags the bottom border
2> The form "flashes" as long as the dragging process is not completed
How to specify that the resizing is still in process (telling the form "do not change the other dimension) or completed ("Do change the other dimension") ?
Thank you very much.