17-11-19, 08:22 PM
(آخر تعديل لهذه المشاركة : 17-11-19, 08:39 PM {2} بواسطة asemshahen5.)
اضف اداة FlowLayoutPanel الى الفورم و جرب هذا الكود :
PHP كود :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each f As String In IO.Directory.GetFiles("D:\08-08-2018\background")
If f.Contains("Thumbs.db") Then
Continue For
End If
ListBox1.Items.Add(f)
Next
For i = 0 To ListBox1.Items.Count - 1
Dim pic As New PictureBox
pic.Name = "Pic" & i
pic.Height = 64
pic.Width = 64
pic.SizeMode = PictureBoxSizeMode.StretchImage
pic.Image = Image.FromFile(ListBox1.Items(i).ToString)
pic.Tag = ListBox1.Items(i).ToString
FlowLayoutPanel1.Controls.Add(pic)
AddHandler pic.Click, AddressOf PicClick
Next
End Sub
Private Sub PicClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim btn1 As PictureBox = CType(sender, PictureBox)
MsgBox(btn1.Tag)
End Sub
سبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
