تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
جمع الروابط و الصور و عرضها في متصفح الانترنت
#1
جمع الروابط و الصور و عرضها في متصفح الانترنت

1. افتح الفيجوال بيسك 2008 (او نسخة الدوت النت التي لديك) ، و اصنع مشروع جديد ، و سمه بالاسم التي تريده (انا سميته image and links grabber)

2. اجعل المشروع كبير ليتحمل الادوات

3. اضف متصفح انترنت سمه (wb) ، و اول زر سمه (btnGo) ، الزر الثاني سمه (btnExtract)
الزر الثالث (btnGetImageSources) ، و مربع نص سمه (txturl) ، و مربع صورة سمه (pic)
و اضف ايضاً قائمة سمها ((LstMain .

صورة اولية



4. تحت كلمةpublic class form1 اكتب هذا الكود


PHP كود :
Dim a As Boolean 
    Dim b 
As Boolean 

5. اضغط على زر btnGo و اكتب هذا الكود فيه

PHP كود :
WB.Navigate(TxtURL.Text

الان اذا شغلنا البرنامج يجب ان تكتب اسم موقع في مربع النص و تضغط على زر go


6. الان اضغط على زر (btnExtract) و اكتب هذا الكود في داخله
PHP كود :
lstmain.Items.Clear() 
        If 
True Then 
            a 
False 
        End 
If 
        If 
False Then 
            b 
True 
        End 
If 
        
'For every link in the current document...           
        For Each ele As HtmlElement In WB.Document.Links 
            '
Get whatever text there is in the 'href' attribute  
            Dim eletarget 
As String ele.GetAttribute("href"
            
'Add it to the listbox  
            LstMain.Items.Add(eletarget) 
            '
Carry on to the next link  
        Next 


الان شغل البرنامج و اكتب رابط في مربع النص و اضغط زر (Go) و اضغط زر ((Extract وسوف تظهر الروابط الخاصة بالصفحة الحالية لمتصفح الانترنت

7. اضغط على زر (imagesource) و اكتب هذا الكود في داخله
PHP كود :
lstmain.Items.Clear() 
        If 
True Then 
            b 
False 
        End 
If 
        If 
False Then 
            a 
True 
        End 
If 
        
'For every HtmlElement (such as a textbox, a button, or image) in the current document...    
        For Each ele As HtmlElement In WB.Document.All 
            '
Make sure it's an image... rather crude but works...  
            If ele.GetAttribute("src") Is Nothing = True Then 
                '
Do nothing  
            
Else 
                
'Its an image  
                '
If the source of the element (assuming there is onecontains .jpg  
                
If ele.GetAttribute("src").ToLower.Contains(".jpg"Then 
                    
'Declare the source of the image as a string (not really neccesary)  
                    Dim imgsrc As String = ele.GetAttribute("src") 
                    '
Add the string to the listbox  
                    LstMain
.Items.Add(imgsrc
                
End If 

                If 
ele.GetAttribute("src").ToLower.Contains(".png"Then 
                    
'Declare the source of the image as a string (not really neccesary)  
                    Dim imgsrc As String = ele.GetAttribute("src") 
                    '
Add the string to the listbox  
                    LstMain
.Items.Add(imgsrc
                
End If 

                If 
ele.GetAttribute("src").ToLower.Contains(".gif"Then 
                    
'Declare the source of the image as a string (not really neccesary)  
                    Dim imgsrc As String = ele.GetAttribute("src") 
                    '
Add the string to the listbox  
                    LstMain
.Items.Add(imgsrc
                
End If 

                If 
ele.GetAttribute("src").ToLower.Contains(".bmp"Then 
                    
'Declare the source of the image as a string (not really neccesary)  
                    Dim imgsrc As String = ele.GetAttribute("src") 
                    '
Add the string to the listbox  
                    LstMain
.Items.Add(imgsrc
                
End If 
            
End If 
        
Next 

8. الان اكتب هذه الدالة

PHP كود :
Imports System.IO 
Imports System
.Net 
Public Function LoadWebImageToPictureBox(ByVal pb _ 
      
As PictureBoxByVal ImageURL As String) As Boolean 

        Dim objImage 
As MemoryStream 
        Dim objwebClient 
As WebClient 
        Dim sURL 
As String Trim(ImageURL
        
Dim bAns As Boolean 
        
Try 
            If 
Not sURL.ToLower().StartsWith("http://"
                 Then sURL 
"http://" sURL 
            objwebClient 
= New WebClient() 

            
objImage = New  
               MemoryStream
(objwebClient.DownloadData(sURL)) 
            
pb.Image Image.FromStream(objImage
            
bAns True 
        
Catch ex As Exception 
            bAns 
False 
        End 
Try 
        Return 
bAns 
    End 
Function 

في اللست البوكس الحدث click اكتب هذا الكود

PHP كود :
If True Then 
            LoadWebImageToPictureBox
(piclstmain.Text
        
End If 
        If 
True Then 
            WB
.Navigate(lstmain.Text
        
End If 


هذه المقالة من إنشائي
متغيب قليلاً للدراسة Smile
الرد }}}
تم الشكر بواسطة:
#2
بارك الله فيك
الرد }}}
تم الشكر بواسطة:
#3
و فيك اخي Smile
متغيب قليلاً للدراسة Smile
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
Video [درس فيديو] تقارير الكريستال ريبورت وتغيير مسار الصور أثناء التشغيل رمضان272 0 1,607 28-03-22, 03:18 AM
آخر رد: رمضان272
  شرح خوارزميات معالجة الصور (من دروس الاستاذ فوزي برزنجي) ناديه الشجيري 19 34,332 20-02-22, 02:13 PM
آخر رد: رضوان الجماعي
  التعامل مع الصور Images في بيئة الدوت نت باستخدام +GDI - مقدمة RaggiTech 3 5,859 30-07-21, 05:14 PM
آخر رد: kebboud
  [VB.NET] سؤال عن طريقة نسخ كل الروابط و اسم الرابط من موقع انترنت toedi 3 3,052 16-01-20, 07:34 AM
آخر رد: toedi
  Compare Images المقارنة بين الصور Abu Ehab 0 3,269 31-10-18, 04:27 PM
آخر رد: Abu Ehab
  مثال القراءة والكتابه على ملف تيكست Txt على الانترنت + مثال + شرح m.sami.ak 11 8,398 02-06-18, 09:46 PM
آخر رد: YousefOkasha
  مقدمة إلي ضغط الصور ..... Zip Bitmap silverlight 0 2,392 10-05-18, 04:35 AM
آخر رد: silverlight
  مشروع لجلب الصور من الماسحة الضوئية (Scanner) m.sami.ak 14 12,086 22-01-17, 10:41 AM
آخر رد: amko
  تحميل ملف من الانترنت مع Progressbar vb.net Basil Abdallah 0 2,526 15-01-17, 03:24 AM
آخر رد: Basil Abdallah
  [VB.NET] تشغيل Twain الخاص بسحب الصور من السكنر في حالة net framework4 ahmed saleh 4 4,377 25-10-15, 07:20 PM
آخر رد: عدنان الشمري

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم