Dim sw,sh As Int
Dim rw,rh As Int
Dim b As Bitmap
b=ImageView1.Bitmap
sw=GetDeviceLayoutValues.Width
sh=GetDeviceLayoutValues.Height
rw=b.Width
rh=b.Height
If (rw/rh)>(sw/sh) Then
ImageView1.Width=sw
ImageView1.Height=rh*sw/rw
Else
ImageView1.Width=rw*sh/rh
ImageView1.Height=sh
End If
ImageView1.Left=(sw-ImageView1.Width)/2
ImageView1.Top=(sh-ImageView1.Height)/2