Is there a faster image loading process?

Hello,

I'm trying to develope a simple image viewer and I'm having a slow down when I try to view many images at a time.

The module currently works, but is slow with large numbers of images.

Are picture boxes the fastest

Would labels, buttons, frames or some other control avoid the slow down

Thanks for your help and advice!

JED_

This is the module that loads and displays the pictures:

Module ShowPics

Public Sub ShowPics(ByVal pics As OpenFileDialog)

Dim intNumPics As Integer = pics.FileNames.Length

Dim intSizeLevel As Integer

If Int(System.Math.Sqrt(intNumPics)) = System.Math.Sqrt(intNumPics) Then

intSizeLevel = Int(System.Math.Sqrt(intNumPics))

Else

intSizeLevel = Int(System.Math.Sqrt(intNumPics)) + 1

End If

For intLoopIndex As Integer = 0 To intNumPics - 1

On Error Resume Next

Dim Pictures As New PictureBox

With Pictures

.Image = Image.FromFile(pics.FileNames(intLoopIndex))

.Show()

.Visible = True

.SizeMode = PictureBoxSizeMode.StretchImage

.Name = "Picture" & CStr(intLoopIndex)

.Text = Form1.OpenFileDialog1.FileNames(intLoopIndex)

.Width = Form1.Panel1.Width / intSizeLevel

.Height = Form1.Panel1.Height / intSizeLevel

.Location = New Point(((intLoopIndex Mod intSizeLevel) * (.Width)), _

(Int(intLoopIndex / intSizeLevel) * (.Height)))

.BorderStyle = BorderStyle.Fixed3D

.Enabled = True

Form1.Panel1.Controls.Add(Pictures)

AddHandler Pictures.Click, AddressOf Form1.Pictures_Click

End With

Next intLoopIndex

End Sub

End Module

 

 



Answer this question

Is there a faster image loading process?

  • Is there a faster image loading process?