打印本文 打印本文 关闭窗口 关闭窗口
用vb.net实现类似写字板程序的部分源代码
作者:武汉SEO闵涛  文章来源:敏韬网  点击数7898  更新时间:2009/4/23 19:01:52  文章录入:mintao  责任编辑:mintao
Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
        Select Case ToolBar1.Buttons.IndexOf(e.Button)
            Case 0
                newfile()
            Case 1
                openfile()
            Case 2
                savefile()
            Case 5
                printfile()
            Case 6
                printpreview()
            Case 9
                Panel1.Visible = True
            Case 12
                rtbox.Cut()
            Case 13
                rtbox.Copy()
            Case 14
                rtbox.Paste()
            Case 15
                rtbox.Undo()


        End Select
    End Sub

 

 

    Private Sub mPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mPrint.Click
        printfile()
    End Sub


    Private Sub comboxFont_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboxFont.SelectedIndexChanged
        SetFontFamily(rtbox, comboxFont.Text)
    End Sub

    Private Sub comboxSize_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboxSize.SelectedIndexChanged
        SetFontSize(rtbox, comboxSize.SelectedItem)
    End Sub

 

 

 

    Private Sub ToolBar2_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar2.ButtonClick
        Select Case ToolBar2.Buttons.IndexOf(e.Button)
            Case 0
                If tbbbold.Pushed = True Then
                    AddFontStyle(rtbox, FontStyle.Bold)
                Else
                    RemoveFontStyle(rtbox, FontStyle.Bold)
                End If


            Case 1
                If tbbi.Pushed = True Then
                    AddFontStyle(rtbox, FontStyle.Italic)
                Else
                    RemoveFontStyle(rtbox, FontStyle.Italic)
                End If

            Case 2
                If tbbu.Pushed = True Then
                    AddFontStyle(rtbox, FontStyle.Underline)
                Else
                    RemoveFontStyle(rtbox, FontStyle.Underline)
                End If

            Case 3
                ColorDialog1.ShowDialog()
                rtbox.ForeColor = ColorDialog1.Color

            Case 6
                rtbox.SelectionAlignment = HorizontalAlignment.Left
                tbbmiddle.Pushed = False
                tbbright.Pushed = False
            Case 7
                rtbox.SelectionAlignment = HorizontalAlignment.Center
                tbbleft.Pushed = False
                tbbright.Pushed = False
            Case 8
                rtbox.SelectionAlignment = HorizontalAlignment.Right
                tbbleft.Pushed = False
                tbbmiddle.Pushed = False

        End Select

    End Sub
    ''''********************************************
    ''''菜单中的隐藏状态栏功能
    Private Sub mStatusbar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mStatusbar.Click
        If mStatusbar.Checked = True Then
            StatusBar1.Visible = False
            mStatusbar.Checked = False
        Else
            StatusBar1.Visible = True
            mStatusbar.Checked = True
        End If
    End Sub
    ''''********************************************
    ''''状态栏的信息
    Private Sub HandleSelect(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mStatusbar.Select, mAbout.Select, mClear.Select, mCopy.Select, mNew.Select, mCut.Select, mEdit.Select, mExit.Select, mFile.Select, mFind.Select, mFindnext.Select, mFont.Select, mHelp.Select, mHelptopics.Select, mOpen.Select, mPagesetup.Select, mPaste.Select, mPrint.Select, mPrintpreview.Select, mReplace.Select, mSave.Select, mSaveas.Select, mSelectall.Select, mStatusbar.Select, mUndo.Select, mView.Select
        Dim strText As String

        If sender Is mStatusbar Then
            strText = "决定是否隐藏状态栏...."
        ElseIf sender Is mAbout Then
            strText = "您将看到我们开发小组的一些资料"
        ElseIf sender Is mClear Then
            strText = "清空所有内容!"
        ElseIf sender Is mExit Then
            strText = "退出程序!"
        ElseIf sender Is mNew Then
            strText = "新建一个文档,会提示保存。。。"
        ElseIf sender Is mCopy Then
            strText = "复制选中的内容"
        ElseIf sender Is mCut Then
            strText = "剪切制定的内容"
        ElseIf sender Is mEdit The

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  下一页

打印本文 打印本文 关闭窗口 关闭窗口