23-12-20, 01:54 AM
(23-12-20, 01:24 AM)asemshahen5 كتب :PHP كود :
Public Class PictureBoxXT
Inherits System.Windows.Forms.PictureBox
Private UrlWebXT As String
Public Property UrlWeb() As String
Get
Return UrlWebXT
End Get
Set(ByVal value As String)
UrlWebXT = value
End Set
End Property
End Class
أضف كلاس جديدة للمشروع و سمها PictureBoxXT و اكتب فيها الكود اعلاه و اعمل ريبلد للمشروع و ستجد الاداة الجديدة في صندوق الادوات و فيها خاصية جديدة من نوع سترنغ باسم UrlWeb و الله الموفق .
و جرب هذا على مثالك أو على مشروع جديد لا تضع في النافذة سوى فلو بانل و اكتب الاكواد التالية :
PHP كود :
Dim vu As String
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim url As String = "https://pastebin.com/raw/6au4aJGx"
Using wc As New Net.WebClient
wc.Encoding = Encoding.UTF8
Dim html As String = wc.DownloadString(url)
Dim str As String = "https.*?\.png"
Dim reg As New Regex(str)
Dim mc As MatchCollection = reg.Matches(html)
Dim ma As Match
Dim x As String = ""
Dim i As Integer = 0
For Each ma In mc
i += 1
x = " الصورة رقم " & i
If ma.Success Then
Dim pb As New PictureBoxXT
pb.SizeMode = PictureBoxSizeMode.Zoom
pb.Width = 250
pb.Height = 50
pb.ImageLocation = ma.Value
pb.UrlWeb = x
pb.Parent = Me.FlowLayoutPanel1
AddHandler pb.Click, AddressOf pb_Click
End If
Next
End Using
End Sub
Private Sub pb_Click(sender As Object, e As EventArgs)
Dim img As PictureBoxXT = CType(sender, PictureBoxXT)
'Process.Start(img.ImageLocation)
MsgBox(img.UrlWeb & " - " & img.ImageLocation)
End Sub
شكرا لك اخي والله انت مبدع