منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : نبدأ تقنيات الvb.net الخاصة(متجدد)
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
ولا نبدا بمتصفح الويب
فورم بها WebBrowser
كود فتح نافذة جديد
PHP كود :
Private Sub WebBrowser1_NewWindow(ByVal sender As ObjectByVal e As System.ComponentModel.CancelEventArgsHandles WebBrowser1.NewWindow 
        
' This will be triggered only when link tries to open in new window.  
        ' 
That means active element in web document will always be a Link
  
        
Dim myElement As HtmlElement WebBrowser1.Document.ActiveElement 
        Dim target 
As String myElement.GetAttribute("href"
  
        
Dim newInstance As New Form1 
        newInstance
.Show() 
        
newInstance.WebBrowser1.Navigate(target
  
        
cancel opening IE window 
        e
.Cancel True 
    End Sub 
كود عرض صورة من الانتر نت

PHP كود :
'WEB CLIENT IS NEEDED TO DO THE DOWNLOAD 
        Dim MyWebClient As New System.Net.WebClient 

        '
BYTE ARRAY HOLDS THE DATA 
        Dim ImageInBytes
() As Byte MyWebClient.DownloadData(TextBox1.Text

        
'CREATE A MEMORY STREAM USING THE BYTES 
        Dim ImageStream As New IO.MemoryStream(ImageInBytes) 

        '
CREATE A BITMAP FROM THE MEMORY STREAM 
        PictureBox1
.Image = New System.Drawing.Bitmap(ImageStream

        AS 
U SEENO FILE NEEDS TO BE WRITTEN TO THE HARD DRIVEITS ALL DONE IN MEMORY 

وهذا يكتب فى زر الامر
PHP كود :
PictureBox1.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData(TextBox1.Text))) 

PHP كود :
Imports System.Drawing.Imaging 


    
' Saves an image as a jpeg image, with the given quality  
    ' 
Gets
    
'   path   - Path to which the image would be saved. 
    '   
quality An integer from 0 to 100with 100 being the  
    
'           highest quality 
    Public Shared Sub SaveJpeg(ByVal path As String, ByVal img As Image, ByVal quality As Long) 
        If ((quality < 0) OrElse (quality > 100)) Then 
            Throw New ArgumentOutOfRangeException("quality must be between 0 and 100.") 
        End If 

        ' 
Encoder parameter for image quality 
        Dim qualityParam 
As New EncoderParameter(Encoder.Qualityquality
        
' Jpeg image codec  
        Dim jpegCodec As ImageCodecInfo = GetEncoderInfo("image/jpeg") 

        Dim encoderParams As New EncoderParameters(1) 
        encoderParams.Param(0) = qualityParam 
        img.Save(path, jpegCodec, encoderParams) 
    End Sub 



    ' 
Returns the image codec with the given mime type  
    
Private Shared Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo 
        
' Get image codecs for all image formats  
        Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders() 

         Find the correct image codec  
        For i As Integer = 0 To codecs.Length - 1 
            If (codecs(i).MimeType = mimeType) Then 
                Return codecs(i) 
            End If 
        Next i 

        Return Nothing 
    End Function 

وهذا هو النداء
PHP كود :
Dim myImage As Image ' ... load the image somehow  
Save the image with a quality of 50%  
SaveJpeg(destImagePathmyImage50
http://www.a1vbcode.com/
هنا مئات اكواد فى شتى اللغات
PHP كود :
Private Sub btnDownload_Click(sender As ObjectAs EventArgs
    
Dim webClient As New WebClient() 
    
webClient.DownloadFileCompleted += New AsyncCompletedEventHandler(AddressOf Completed
    
webClient.DownloadProgressChanged += New DownloadProgressChangedEventHandler(AddressOf ProgressChanged
    
webClient.DownloadFileAsync(New Uri("http://mysite.com/myfile.txt"), "c:\myfile.txt"
End Sub 

Private Sub ProgressChanged(sender As ObjectAs DownloadProgressChangedEventArgs
    
progressBar.Value e.ProgressPercentage 
End Sub 

Private Sub Completed(sender As ObjectAs AsyncCompletedEventArgs
    
MessageBox.Show("Download completed!"
End Sub 
الفقير الى ربه
سامر عبد الله عبد الغني