My program lets users resize the form. I maintain the form ratio this way:
Private Sub frmMain_Resize(sender As Object, e As EventArgs) Handles Me.Resize dblRatio = Screen.PrimaryScreen.Bounds.Height / Screen.PrimaryScreen.Bounds.Width Me.Height = Me.Width * dblRatio ' me.width = me.height * dblRatio End Sub
This works just fine if the user grabs the form from the side or the corners, but I can't do the same if resized from the top or bottom (or vice versa if I comment/uncomment me.height/me.width.)
If I knew how to detect what's being dragged, I could precede each with an "If" so only one or the other is executed.