Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox2.Text = "http://localhost/a/2.php?MyName="
        TextBox4.Text = "MyNum="
        Panel1.Show()
        Panel2.Hide()  '點餐
        Panel3.Hide() ' 狀態
        Label1.Hide()
        TextBox1.Hide()
        TextBox2.Hide()
        TextBox4.Hide()
        TextBox6.Hide()
        TextBox7.Hide() '顯示網頁的資訊
        WebBrowser1.Hide()
        ToolStrip1.Hide()
        Button3.Enabled = False

    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = TextBox2.Text + TextBox3.Text + "&" + TextBox4.Text + TextBox5.Text
        'TextBox1.Text = "http://localhost/a/1-1.php"
        TextBox2.Text = "http://localhost/a/2.php?MyName="

       
        If TextBox3.Text = "123" And TextBox5.Text = "123" Then
            If TextBox1.Text <> String.Empty Then
                Me.WebBrowser1.Navigate(TextBox1.Text)  ' WebBrowser1 網頁載入
            End If
            MessageBox.Show("成功登入")
            Timer1.Enabled = True
            Panel1.Hide()
            Panel2.Show()
            ToolStrip1.Show()
        Else
            MessageBox.Show("請重新輸入")


        End If

    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
        Dim getReader As New System.IO.StreamReader(Me.WebBrowser1.DocumentStream, System.Text.Encoding.Default)
        Dim gethtml = getReader.ReadToEnd()
        TextBox6.Text = gethtml
    End Sub
   

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim a As String
        Dim b As String
        Dim c As String
        Dim d As String
        Dim k As String
        Dim f As String

        a = TextBox7.Text(0)
        b = TextBox7.Text(1)
        c = TextBox7.Text(2)
        d = TextBox7.Text(3)
        k = TextBox7.Text(4)
        f = TextBox7.Text(5)

     

        PictureBox1.Image = Image.FromFile("C:\Users\user\Desktop\123\" + a + ".jpg")
        PictureBox2.Image = Image.FromFile("C:\Users\user\Desktop\123\" + b + ".jpg")
        PictureBox3.Image = Image.FromFile("C:\Users\user\Desktop\123\" + c + ".jpg")
        PictureBox4.Image = Image.FromFile("C:\Users\user\Desktop\123\" + d + ".jpg")
        PictureBox5.Image = Image.FromFile("C:\Users\user\Desktop\123\" + k + ".jpg")
        PictureBox6.Image = Image.FromFile("C:\Users\user\Desktop\123\" + f + ".jpg")

    End Sub

   

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Increment(1)
        Label1.Show()
        If ProgressBar1.Value = ProgressBar1.Maximum Then   '跑到最頂端的時候
            TextBox7.Text = WebBrowser1.Document.Body.InnerText '抓取網頁文字內容
            '==========用法
            'TextBox7.Text = WebBrowser1.Document.Body.InnerText '抓取網頁文字內容
            '或
            'text1.text = WebBrowser1.Document.body.outerText
            'text1.text = WebBrowser1.Document.body.innerHTML
            'text1.text = WebBrowser1.Document.body.outerHTML
            '==========用法
            Button3.Enabled = True  '打開下載
            ProgressBar1.Hide()
            Label1.Hide()
        End If
    End Sub

    Private Sub ToolStripLabel6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel6.Click
        Panel1.Hide()
        Panel2.Hide()
        Panel3.Show() '狀態
    End Sub

    Private Sub ToolStripLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel1.Click
        Panel1.Hide()
        Panel2.Show()
        Panel3.Hide() '點餐
    End Sub
End Class


阿倫 發表在 痞客邦 PIXNET 留言(0) 人氣()