MTSkull
Well-known member
The following code causes an Out Of Memory Error when it cycles continuously as a screen saver, any thoughts.
Code:
Public bFirstMove As Boolean = True
Public Pics() As String
Public pos As Int16
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.CenterToScreen()
picBox.Height = Me.Height
picBox.Width = Me.Width
Pics = Directory.GetFiles("C:\Pictures")
pos = 0
picBox.Image = Drawing.Bitmap.FromFile(Pics(pos))
Me.Cursor.Hide()
End Sub
Private Sub Form1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles MyBase.KeyUp
Me.Close()
End Sub
Private Sub picBox_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles picBox.MouseMove
Static iCount As Long
If iCount > 2 Then
Me.Close()
Else
iCount = iCount + 1
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Timer1.Tick
pos += 1
If pos = UBound(Pics) Then
pos = 0
End If
picBox.Image = Drawing.Bitmap.FromFile(Pics(pos))
End Sub