Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("lyDraw")
bmpImage=LoadBitmap(File.DirAssets,"charly.jpg")
bmpWidth = bmpImage.Width
bmpHeight = bmpImage.Height
'sets the panel aspect ratio to the image aspect ratio
If bmpWidth / bmpHeight > pnlImage.Width / pnlImage.Height Then
pnlImage.Height = bmpHeight * pnlImage.Width / bmpWidth
Else
pnlImage.Width = bmpHeight * pnlImage.Height / bmpHeight
End If
'save the original panel size
pnlImageWidth = pnlImage.Width
pnlImageHeight = pnlImage.Height