Public Class DrawTextSpace

    Private Sub DrawTextSpace_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()
        If IsNumeric(TextBox2.Text) = False Or IsNumeric(TextBox3.Text) = False Then
            MsgBox("行间距或字符间距设置不正确，不是有效的数字")
            Exit Sub
        End If
        If CSng(TextBox3.Text) = 0 Then
            '字符间距用默认
            '只设置行间呀
            myp.DrawTextEx(TextBox1.Text, New Font("宋体", 13), Brushes.Blue, CSng(TextBox2.Text))
        Else
            myp.DrawTextEx(TextBox1.Text, New Font("宋体", 13), Brushes.Blue, CSng(TextBox2.Text), CSng(TextBox3.Text))
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myp.InvalidatePreview()
    End Sub
End Class