21-02-16, 07:44 PM
مشاركة لاخواني خذ المثال
مربع صورة ومؤقت معطل
ثم خذ الكلاس للفورم
مربع صورة ومؤقت معطل
ثم خذ الكلاس للفورم
PHP كود :
Imports System.IO
Public Class Form1
Dim imgs As New List(Of Image)
Private Function IsValidImage(filename As String) As Boolean
Try
Dim img As System.Drawing.Image = System.Drawing.Image.FromFile(filename)
Catch generatedExceptionName As OutOfMemoryException
' Image.FromFile throws an OutOfMemoryException
' if the file does not have a valid image format or
' GDI+ does not support the pixel format of the file.
'
Return False
End Try
Return True
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim fbd As New FolderBrowserDialog
If fbd.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim dir As New DirectoryInfo(fbd.SelectedPath)
For Each fl As FileInfo In dir.GetFiles
If IsValidImage(fl.FullName) Then
Dim im As Image = Image.FromFile(fl.FullName)
imgs.Add(im)
End If
Next
Else
MsgBox("لابد من اختيار مجلد الصور", MsgBoxStyle.Critical) : End
End If
If imgs.Count > 0 Then
Timer1.Start()
End If
End Sub
Dim i As Integer = 0
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
i = Rnd() * imgs.Count - 1
Try
PictureBox1.Image = imgs(i)
Catch ex As Exception
End Try
End Sub
End Class
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير

