2012-11-30 34 views
1

我有一個名爲fWidth全局變量是目前300vb.net多pictureBoxes,寬度相同,保持縱橫比

我設置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 

瓦在應該正確的代碼是?

回答

相關問題