章魚哥出品—VB.NET Office操作之Word(四)

來源:互聯網
上載者:User

標籤:office   vb.net   word   章魚哥   

本文是在 章魚哥出品—VB.NET Office操作之Word(二)中新增內容的具體實現,讀者可以借鑒看下,注意本文應該與三結合在一起使用,是在三的基礎上添加了幾種功能的實現。

實現表單:

 




代碼實現:代碼直接複製到上文的表單類中

 

 

'*********************************************************************'章魚哥,QQ:3107073263 群:309816713    '如有疑問或好的建議請聯絡我,大家一起進步  '*********************************************************************   '擷取文檔路徑    Private Sub But_GetAdrress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_GetAdrress.Click        Dim opendialog As New OpenFileDialog        If opendialog.ShowDialog = DialogResult.OK Then            TextBox1.Text = opendialog.FileName        End If    End Sub    '擷取當前滑鼠的位置     Private Sub But_GetCursor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_GetCursor.Click        For Each Word_Class As Class_Word1 In Array_Word            Dim Cursor As ArrayList = Word_Class.GetCursor()            If Cursor IsNot Nothing Then                For i = 0 To Cursor.Count - 1                    RichTextBox1.Text &= "  " & Cursor(i)                Next            End If        Next    End Sub    '將游標移動到指定頁    Private Sub But_GoTo_Page_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_GoTo_Page.Click        For Each Word_Class As Class_Word1 In Array_Word            Word_Class.GoToPage(Tex_Page.Text)        Next    End Sub    '游標移動到指定行(絕對)    Private Sub But_GotoAbsoultRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_GotoAbsoultRow.Click        For Each Word_Class As Class_Word1 In Array_Word            Word_Class.GoToAbsolutLine(Tex_Row_Absoult.Text)        Next    End Sub    '游標移動到指定行(相對)    Private Sub But_GotoOppsitRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles But_GotoOppsitRow.Click        For Each Word_Class As Class_Word1 In Array_Word            Word_Class.GoToOppsiteLine(Tex_Row_Oppsit.Text)        Next    End Sub    '上下左右按鈕,點擊按鈕一次移動一位    Private Sub PictureBox1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp        'MsgBox("X:" & e.X & "Y:" & e.Y)        Dim x As Integer = e.X        Dim y As Integer = e.Y        'RichTextBox1.Text &= "|" & e.X & ":" & e.Y        For Each Word_Class As Class_Word1 In Array_Word            If x > 70 And x < 130 Then                If y > 20 And y < 45 Then                    Word_Class.MoveUp()                ElseIf y > 110 And y < 135 Then                    Word_Class.MoveDown()                End If            End If            If y > 45 And y < 105 Then                If x > 40 And x < 65 Then                    Word_Class.MoveLeft()                ElseIf x > 135 And y < 160 Then                    Word_Class.MoveRight()                End If            End If        Next    End Sub


 

章魚哥出品—VB.NET Office操作之Word(四)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.