Sub SetPhoto(Data() As Byte)
Dim inp As InputStream
inp.InitializeFromBytesArray(Data,0,Data.Length)
Dim B As Bitmap
B.Initialize2(inp)
Log("Picture Width:" & B.Width & " Height:" & B.Height)
AdjustImageView(ImageView1,B)
'ImageView1.SetBackgroundImage(B)
'ImageView1.Bitmap = B
'ImageView1.Invalidate
End Sub
Sub AdjustImageView(Imv As ImageView, bmp As Bitmap) 'Vorlage von klaus
'mal meine Formel heraus suchen .. in diashow oder so
Dim Delta, Height, Width As Int
If bmp.Width / bmp.Height > Imv.Width / Imv.Height Then
Height = bmp.Height / bmp.Width * Imv.Width
Delta = (Imv.Height - Height) / 2
Imv.Height = Height
Imv.Top = Imv.Top + Delta
Else
Width = bmp.Width / bmp.Height * Imv.Height
Delta = (Imv.Width - Width) / 2
Imv.Width = Width
Imv.Left = Imv.Left + Delta
End If
Imv.Gravity = Gravity.FILL
Imv.Bitmap = bmp
End Sub