Can anybody suggest a more efficient way of doing this.
My main programme can load multiple images into a picture box sequentially, sizing the Picture box according to the limitations of the graphics card memory. So with 256 MB of memory I can achieve a picture box 4 x 4 of the screen size.
I now want to give the users the ability to rearrange their photo's before adding them to the picture box and to do this I have a form which equals the screen size and I add each of the users selected photo's into an image box. Loading and resizing the image boxes as I go.
This is my code that loads the Image Boxes:
My problem is that if the user selects a couple of hundred photos then the whole thing starts to bog down and gets slower and slower until it eventually bombs out on an Error 7.
Can this be done more efficiently or do I need to have a re-think about what I am trying to achieve.
Thanks in advance.
Alan
[gray]Experience is something you don't get until just after you need it.[/gray]
My main programme can load multiple images into a picture box sequentially, sizing the Picture box according to the limitations of the graphics card memory. So with 256 MB of memory I can achieve a picture box 4 x 4 of the screen size.
I now want to give the users the ability to rearrange their photo's before adding them to the picture box and to do this I have a form which equals the screen size and I add each of the users selected photo's into an image box. Loading and resizing the image boxes as I go.
This is my code that loads the Image Boxes:
Code:
Dim i As Integer
Dim a As Integer
Dim Count As Integer
Dim X1 As Long, Y1 As Long
Me.MousePointer = vbHourglass
On Error GoTo ErrHandler
For i = 0 To frmMain.lstFiles.ListCount - 1
DoEvents
Fname = frmMain.lstFiles.List(i)
With Image1(a)
.Visible = True
.Picture = LoadPicture(Fname)
.Width = PicWidth
.Height = PicHeight
.Left = X1
.Top = Y1
End With
X1 = X1 + PicWidth
Count = Count + 1
If Count >= NumWide Then
Count = 0
X1 = 0
Y1 = Y1 + (PicHeight)
End If
a = a + 1
Load Image1(a)
End If
Here:
Next i
Me.MousePointer = vbDefault
My problem is that if the user selects a couple of hundred photos then the whole thing starts to bog down and gets slower and slower until it eventually bombs out on an Error 7.
Can this be done more efficiently or do I need to have a re-think about what I am trying to achieve.
Thanks in advance.
Alan
[gray]Experience is something you don't get until just after you need it.[/gray]