我有一个名为 fWidth 的全局变量,目前为 300。
我正在设置pictureBox.width = fWidth,但后来我想做类似pictureBox.height = calcImgHeight(originalHeight,originalWidth)
这就是问题所在,因为我的数学很糟糕:D
Private Function calcImgHeight(oHeight, oWidth)
Dim nHeight, ratio As Integer
ratio = oWidth / fWidth
nHeight = oHeight / ratio
Return nHeight
End Function
正确的代码应该是什么?