Page 1 of 1
Aspect ratio
Posted: Sun Jun 10, 2012 9:56 am
by gille
Hello,
I want to resize my windows form, but it must keep the aspect ratio 16:9.
How can I do this?
Greetings,
gille
Re: Aspect ratio
Posted: Sun Jun 10, 2012 2:17 pm
by Usman55
Well, the way I'd do it, would be to use the calculator and then multiply/divide both the numbers with a constant. For example, if I want to get the ratio of an A4 size paper in paint then I'd multiply the dimensions by 2 or 3 (210*297).
Re: Aspect ratio
Posted: Sun Jun 10, 2012 5:08 pm
by MrAksel
Code: Select allDim ratio As Double = 16 / 9
'To get the width: Width = ratio * Height'
'To get the Height: Height = Width / ratio'
I can't test it now since I'm on my iPod. When I get to my PC I can also give a better example.
Re: Aspect ratio
Posted: Mon Jun 11, 2012 9:56 pm
by Ffenixw0rks
Your code will be:
Code: Select all Private Sub Form1_Resize(sender As System.Object, e As System.EventArgs) Handles MyBase.Resize
Me.Width = Me.Height * 1.77
End Sub
Or
better way.
+REP if helped.
Re: Aspect ratio
Posted: Tue Jun 12, 2012 12:22 pm
by MrAksel
My code is the same as yours, you just calculated the 16/9 value

The better way was I had in mind too, I just forgot to update my answer :lol: Great that you posted it