Hello,
I'm trying to make a photo slide show in VB6. I'm trying to get the right size for my pictures, they have to fill up the screen entirely. It works with the first picture. But when a picture has another resolution it gets the same shape as the picture that was showed before.
I've got this so far:
[CODE=vb]Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim X As Integer
Dim Y As Integer
Dim A As Double
Dim B As Integer
gX = gX + 1
' (gX is in a module like this: Public gX as Integer)
X = 0
Y = 0
A = 0
B = 0
Image1.Picture = LoadPicture("C: \Documents and Settings\Jeroen \Mijn documenten\mijn afbeeldingen\Fo to diashow\" & gX & ".jpg")
'You will get the image dimensions in pixels. to get them in Twips scale, remove
' the "/ Screen.TwipsPer PixelY" and "/ Screen.TwipsPer PixelX" below.
' MsgBox "Image Height: " & Image1.Height / Screen.TwipsPer PixelY & "Image width: " & Image1.Width / Screen.TwipsPer PixelX
X = Image1.Height
Y = Image1.Width
Image1.Stretch = True
If X < Y Then
ResWidth = Screen.Width \ Screen.TwipsPer PixelX
ResHeight = Screen.Height \ Screen.TwipsPer PixelY
'A = ResHeight
B = ResWidth
A = (ResWidth * Image1.Height) / Y
Image1.Height = A * 15
Image1.Width = B * 15
Else
ResWidth = Screen.Width \ Screen.TwipsPer PixelX
ResHeight = Screen.Height \ Screen.TwipsPer PixelY
A = ResHeight
'B = ResWidth
B = (ResHeight * Image1.Width) / X
Image1.Height = A * 15
Image1.Width = B * 15
End If
End Sub[/CODE]
Can anybody help me?
I'm trying to make a photo slide show in VB6. I'm trying to get the right size for my pictures, they have to fill up the screen entirely. It works with the first picture. But when a picture has another resolution it gets the same shape as the picture that was showed before.
I've got this so far:
[CODE=vb]Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim X As Integer
Dim Y As Integer
Dim A As Double
Dim B As Integer
gX = gX + 1
' (gX is in a module like this: Public gX as Integer)
X = 0
Y = 0
A = 0
B = 0
Image1.Picture = LoadPicture("C: \Documents and Settings\Jeroen \Mijn documenten\mijn afbeeldingen\Fo to diashow\" & gX & ".jpg")
'You will get the image dimensions in pixels. to get them in Twips scale, remove
' the "/ Screen.TwipsPer PixelY" and "/ Screen.TwipsPer PixelX" below.
' MsgBox "Image Height: " & Image1.Height / Screen.TwipsPer PixelY & "Image width: " & Image1.Width / Screen.TwipsPer PixelX
X = Image1.Height
Y = Image1.Width
Image1.Stretch = True
If X < Y Then
ResWidth = Screen.Width \ Screen.TwipsPer PixelX
ResHeight = Screen.Height \ Screen.TwipsPer PixelY
'A = ResHeight
B = ResWidth
A = (ResWidth * Image1.Height) / Y
Image1.Height = A * 15
Image1.Width = B * 15
Else
ResWidth = Screen.Width \ Screen.TwipsPer PixelX
ResHeight = Screen.Height \ Screen.TwipsPer PixelY
A = ResHeight
'B = ResWidth
B = (ResHeight * Image1.Width) / X
Image1.Height = A * 15
Image1.Width = B * 15
End If
End Sub[/CODE]
Can anybody help me?
Comment