Public Class DrawTextSpace2

    Private Sub DrawTextSpace2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '将计量单位设置为1%厘米
        myp.PageUnits = VBprinter.VB2008Print.PageExportUnit.CentiMeter
        myp.InvalidatePreview()
    End Sub

    Private Sub myp_PrintDocument() Handles myp.PrintDocument
        myp.NewPage()
        Dim myfont1 As New Font("黑体", 18, FontStyle.Bold)
        Dim myfont2 As New Font("宋体", 12)
        Dim myformat As New StringFormat(StringFormat.GenericTypographic)
        myformat.Alignment = StringAlignment.Center
        myp.DrawText("1 普通的DrawText打印文本的结果如下", myp.PaperPrintWidth(), myfont1, Color.Red, myformat)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawText(TextBox1.Text, myfont2)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawText("2 用DrawTextEx函数以单倍行距打印文本的结果如下", myp.PaperPrintWidth(), myfont1, Color.Red, myformat)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawTextEx(TextBox1.Text, myfont2, Brushes.Blue, -1)

        myp.NewRow(myp.LastDrawTextHeight * 2)
        myp.DrawText("3 用DrawTextEx函数以2倍行距打印文本的结果如下", myp.PaperPrintWidth(), myfont1, Color.Red, myformat)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawTextEx(TextBox1.Text, myfont2, Brushes.Blue, -2)

        myp.NewRow(myp.LastDrawTextHeight + myp.LastDrawTextHeight * 2)
        myp.DrawText("4 用DrawTextEx函数以0.5倍行距打印文本的结果如下", myp.PaperPrintWidth(), myfont1, Color.Red, myformat)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawTextEx(TextBox1.Text, myfont2, Brushes.Blue, -0.5)

        myp.NewRow(myp.LastDrawTextHeight + myp.LastDrawTextHeight * 0.5)
        myp.DrawText("5 用DrawTextEx函数以固定行距(5毫米)打印文本的结果如下", myp.PaperPrintWidth(), myfont1, Color.Red, myformat)
        myp.NewRow(myp.LastDrawTextHeight)
        myp.DrawTextEx(TextBox1.Text, myfont2, Brushes.Blue, 50)


    End Sub


End Class