Public Class Form14

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '直接在本窗口中的实现方法 
        '只是打印简单的内容，更复杂的内容（如打印DGV，打印复杂表头），调用相应的函数即可
        Dim p As New VBprinter.VB2008Print
        p.IsImmediatePrintNotPreview = True '不预览立即打印到打印机
        p.IsImmediatePrintNotPreviewShowPrintDialog = True '打印前显示打印机选择对话框
        p.NewDoc()
        p.NewPage()
        p.DrawText("这是一个简单的演示（第一页）", New Font("黑体", 40), Color.Blue, 0)
        '还可以调用其他的函数进行打印
        p.NewPage()
        p.DrawText("这是第二页", New Font("华文行楷", 23), 0)
        p.EndDoc()
        p.Dispose()
        p = Nothing
    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim f As New Form11
        f.rowstoprint = CInt(TextBox1.Text)
        f.isimmediateprint = False
        f.ShowDialog()
        f.Dispose()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim f As New Form11
        f.rowstoprint = CInt(TextBox1.Text)
        f.isimmediateprint = True
        f.IsImmediatePrintNotPreviewShowPrintDialog = True
        f.Show()
        f.Dispose()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim f As New Form11
        f.rowstoprint = CInt(TextBox1.Text)
        f.isimmediateprint = True
        f.IsImmediatePrintNotPreviewShowPrintDialog = False
        f.Show()
        f.Dispose()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        '直接在本窗口中的实现方法 
        '只是打印简单的内容，更复杂的内容（如打印DGV，打印复杂表头），调用相应的函数即可
        Dim p As New VBprinter.VB2008Print
        p.IsImmediatePrintNotPreview = True '不预览立即打印到打印机
        p.IsImmediatePrintNotPreviewShowPrintDialog = False '打印前不显示打印机选择对话框
        p.IsShowProgess = False '不显示预览进度状态窗口
        p.IsShowPrintStatusDialog = False '不显示打印进度窗口
        p.NewDoc()
        p.NewPage()
        p.DrawText("这是一个简单的演示（第一页）", New Font("黑体", 40), Color.Blue, 0)
        '还可以调用其他的函数进行打印
        p.NewPage()
        p.DrawText("这是第二页", New Font("华文行楷", 23), 0)
        p.EndDoc()
        p.Dispose()
        p = Nothing
    End Sub
End Class
