Private Sub Form_Resize() If Me.WindowState = vbMaximized Then Me.WindowState = vbNormal End If If Me.WindowState = vbNormal Then Me.Width = Me.Height Me.Height = Me.Width End If End Sub
Private Sub Form_Resize() If Form1.Height > Form1.Width Then Form1.Width = Form1.Height ElseIf Form1.Width > Form1.Height Then Form1.Height = Form1.Width End If End Sub
Private frmWidth As Integer Private frmHeight As Integer
Private Sub Form_Resize() If Me.WindowState = vbMaximized Then Me.WindowState = vbNormal End If If Me.WindowState = vbNormal Then If Me.Width <> frmWidth Then Me.Height = Me.Width End If If Me.Height <> frmHeight Then Me.Width = Me.Height End If End If frmWidth = Me.Width frmHeight = Me.Height End Sub
Private frmWidth As Integer Private frmHeight As Integer
Private Sub Form_Resize() If Me.WindowState = vbMaximized Then Me.WindowState = vbNormal End If If Me.WindowState = vbNormal Then If Abs(Me.Width - frmWidth) > Abs(Me.Height - frmHeight) Then Me.Height = Me.Width Else Me.Width = Me.Height End If End If frmWidth = Me.Width frmHeight = Me.Height End Sub