Public Sub Calc_Width(widthPercent As Float, widthPx As Float, KeepRatio As Boolean)
CalcWidth = 0
CalcHeight = 0
If widthPercent = 0 And widthPx = 0 Then Return
If widthPercent > 0 Then
CalcWidth = widthPercent / 100 * gWidth
Else
CalcWidth = widthPx
End If
If KeepRatio Then
Dim Ratio As Float = gWidth / CalcWidth
Else
Dim Ratio As Float = 1
End If
CalcHeight = gHeight / Ratio
End Sub
Public Sub Calc_Height(heightPercent As Float, heightPx As Float, KeepRatio As Boolean)
CalcWidth = 0
CalcHeight = 0
If heightPercent = 0 And heightPx = 0 Then Return
If heightPercent > 0 Then
CalcHeight = heightPercent / 100 * gHeight
Else
CalcHeight = heightPx
End If
If KeepRatio Then
Dim Ratio As Float = gHeight / CalcHeight
Else
Dim Ratio As Float = 1
End If
CalcWidth = gWidth / Ratio
End Sub