Sub FitCenterBitmapBMPzoom(Imv As ImageView, bmp As Bitmap)
Private cvs As Canvas
cvs.Initialize(Imv)
Dim rectDest As Rect
Dim delta As Int
If bmp.Width / bmp.Height > Imv.Width / Imv.Height Then
delta = (Imv.Width - bmp.Width / bmp.Height * Imv.Height) / 2
rectDest.Initialize(delta, 0, Imv.Width - delta, Imv.Height)
Else
delta = (Imv.Height - bmp.Height / bmp.Width * Imv.Width) / 2
rectDest.Initialize(0, delta,Imv.Width, Imv.Height - delta)
End If
cvs.DrawBitmap(bmp, Null, rectDest)
Imv.Invalidate
End Sub