0

I am writing a slide show. The slide show itself is not bad.
My problem:
I can put the pictures in the resource area. This would require recompiling and sending the viewer each time I want to send pictures. I would like to send the pictures seperatlly and have the viewer read them. I can do this by putting the pictures in a folder then reading the folder.
I was thinking about an image library but I can't find anything on the internet about writting one. How does PowerPoint save their images?
Any help would be appreciated.

2
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by waynespangler
0

What control(s) are you using? What do you use to act as the source of your images? Do you preload an imagelist control?

0

I am using a picturebox for the image. My images are jpeg. I had thought about the imagelist but the images are pretty big. Isn't the image list limited to about 128x128 pixels.
Thanks for your quick reply.

0

Here is one way to do it.

Dim i As System.Drawing.Image
        Dim Filename As String
        Dim FilePath As String = <path to images>

        Filename = Dir(FilePath + "*.jpg")
        Do While Not Filename Is Nothing
            i = Image.FromFile(FilePath + Filename)

            ' Perfrom any scaling or rotating here

            ' Show it on the form
            PictureBox1.Image = i
            ' Give windows a second to update the screen
            Application.DoEvents()
            ' Wait for a second until moving on to next picture
            System.Threading.Thread.Sleep(1000)

            ' Get the next filename
            Filename = Dir()
        Loop
0

Thanks for your input, I appreciate it but that is the way I was doing it.
After more thought i came up with an image that holds all the images (thanks to person that gave me the idea).
For anyone interested, here is what I did.

' to hold the pointers where the image is located.
    Structure strImageIndex
        Dim x As Integer
        Dim y As Integer
    End Structure

    Dim ImageIndex As New strImageIndex   ' the pointer
    Dim MaxCol As Integer = 4                     ' how many pictures across
    Dim MaxRow As Integer = 3                   ' how many pictures down
    ' this is the bitmap the pictures will be kept in
    Dim bmp As New Bitmap(MaxCol * 400, MaxRow * 300, Imaging.PixelFormat.Format32bppArgb)

    '===========================================================================
    '     load the image and change size to 400 x 300    
    '     (you might want to change this...all my pictures are 400 x 300)
    '=========================================================================
    Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
        With OpenFileDialog1
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                Dim bmp1 As New Bitmap(.FileName)
                ' this is the source rectangle or image size
                Dim srcRect As New Rectangle(0, 0, bmp1.Width, bmp1.Height)
                ' this is the size the image will be converted to
                Dim destRect As New Rectangle(0, 0, 400, 300)
                ' set up the blank bitmap and set the graphics for it.
                Dim bmp2 As New Bitmap(400, 300, Imaging.PixelFormat.Format32bppArgb)
                Dim g As Graphics = Graphics.FromImage(bmp2)
                ' now draw the destination rect from the source rectangle using pixels
                g.DrawImage(bmp1, destRect, srcRect, GraphicsUnit.Pixel)
                ' put the bitmap in the picturebox image. NOTE: the clone is used because once it is disposed of
                ' then the picturebox  image is erased.
                PictureBox1.Image = bmp2.Clone
                ' get rid of the bitmaps
                bmp1.Dispose()
                bmp2.Dispose()
            End If
        End With
    End Sub

    '================================================================
    '     draw the image into the bitmap and change the image index to point to the next picture location
    '================================================================
    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Using g As Graphics = Graphics.FromImage(bmp)
            g.DrawImage(PictureBox1.Image, New Point(ImageIndex.x * 400, ImageIndex.y * 300))
            ImageIndex.x += 1
            If ImageIndex.x > MaxCol Then
                ImageIndex.x = 0
                ImageIndex.y += 1
            End If
        End Using
    End Sub

    '===========================================================================
    '     Save the completed image
    '===========================================================================
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        With SaveFileDialog1
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                bmp.Save(.FileName, Imaging.ImageFormat.Bmp)
            End If
        End With
    End Sub
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.