Sub AdjustImageView(Imv As ImageView, bmp As Bitmap)
'MR 09.09.2018 (from vb6)
Dim bx1 As Long
Dim by1 As Long
Dim bx2 As Long
Dim by2 As Long
Dim f1 As Float
Dim f2 As Float
Dim ox,oy,oxx,oyy As Float
ox = Imv.Left
oy = Imv.Top
oxx = Imv.Width
oyy = Imv.Height
bx1 = bmp.Width
by1 = bmp.Height
bx2 = oxx
by2 = oyy
If bx1 = 0 Or by1 = 0 Then 'größe wie PictureBox
bx1 = bx2
by1 = by2
End If
f1 = 1.0
f2 = 1.0
If bx1 <> bx2 Then 'ohne ZOOM > mit ZOOM <>
f1 = bx2 / bx1
End If
If by1 <> by2 Then
f2 = by2 / by1
End If
If f2 < f1 Then f1 = f2
Imv.Gravity = Bit.Or( Gravity.FILL,Gravity.CENTER)
Imv.Left = ox + oxx / 2.0 - (bx1 * f1) / 2.0
Imv.Top = oy + oyy / 2.0 - (by1 * f1) / 2.0
Imv.Width = f1 * bx1
Imv.Height = f1 * by1
Imv.Bitmap = bmp
End Sub