Photo slide show in VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Oelie
    New Member
    • Aug 2007
    • 1

    Photo slide show in VB6

    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?
    Last edited by Killer42; Aug 21 '07, 08:40 AM. Reason: Added CODE=vb tag
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Is Image1.Stretch True or False at design time? If it's False, then X and Y are being set differently for the first image than for any subsequent ones.

    Comment

    Working...