hey
i ve an imagebox height=5820 width=6400 which dynamically loads any image. now the problem is when i set its stretch property true it displays the pic but it appear strectched and distorted.
if i use the following code it displays the pic in its original size....bt the dimensions of my imagebox change.
Dim Left As Long, Top As Long, Width As Long, Height As Long
Dim AspectRate As Double
imgPhoto.Visible = False
imghoto.Stretch = False
AspectRate = imghoto.Width / imgPhoto.Height
If AspectRate > imgPhoto.Container.ScaleWidth / imgPhoto.Container.ScaleHeight Then
'Picture is Wide
Width = imgPhoto.Container.ScaleWidth
Height = Width / AspectRate
Left = (imgCandidatePhoto.Width / 2 - imgPhoto.Container.ScaleWidth / 2) / 2
Else
'Picture is High
Height = img Dim Left As Long, Top As Long, Width As Long, Height As Long
Dim AspectRate As Double
imgCandidatePhoto.Visible = False
imgCandidatePhoto.Stretch = False
AspectRate = imgCandidatePhoto.Width / imgCandidatePhoto.Height
If AspectRate > imgCandidatePhoto.Container.ScaleWidth / imgCandidatePhoto.Container.ScaleHeight Then
'Picture is Wide
Width = imgCandidatePhoto.Container.ScaleWidth
Height = Width / AspectRate
Left = (imgCandidatePhoto.Width / 2 - imgCandidatePhoto.Container.ScaleWidth / 2) / 2
Else
'Picture is High
Height = imgCandidatePhoto.Container.ScaleHeight
Width = Height * AspectRate
Left = (imgCandidatePhoto.Container.ScaleWidth / 2 - imgCandidatePhoto.Width / 2) / 2
End If
imgPhoto.Move Left, Top, Width, Height
imgPhoto.Visible = True
Top=60
imgCandidatePhoto.Move Left, Top, Width, Height
imgCandidatePhoto.Visible = True
How can i display my images in the fixed imagebox dimensions without distorting the image?