Public Class printzdx
    Private Sub 刷新打印预览结果_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 刷新打印预览结果.Click
        myp.InvalidatePreview()
    End Sub

    Private Sub printzdx_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        myp.PageUnits = VBprinter.VB2008Print.PageExportUnit.CentiMeter '计量单位为1%厘米
        myp.IsDrawZDX = True '打印装订线
        myp.InvalidatePreview()
    End Sub
    Private Sub myp_PrintDocument() Handles myp.PrintDocument
        myp.NewPage()
        If IsNumeric(zdxposition.Text) = False Then
            MsgBox("无法打印装订线，装订线位置不正确，不是有效的数字")
            zdxposition.Focus()
            Exit Sub
        End If
        myp.ZDXPosition = CSng(zdxposition.Text)
        myp.DrawText("装订线打印测试。控件5.1版增加了对装订线打印的支持，允许您设置各种装订线", New Font("宋体", 20))
        myp.ZDXText = zdxtext.Text
        If zdxtype_left.Checked = True Then
            myp.ZDXType = VBprinter.VB2008Print.TheZDXTYPE.LEFT
        ElseIf zdxtype_top.Checked = True Then
            myp.ZDXType = VBprinter.VB2008Print.TheZDXTYPE.TOP
        ElseIf zdxtype_right.Checked = True Then
            myp.ZDXType = VBprinter.VB2008Print.TheZDXTYPE.RIGHT
        ElseIf zdxtype_bottom.Checked Then
            myp.ZDXType = VBprinter.VB2008Print.TheZDXTYPE.BOTTOM
        End If
        If zdx_dash.Checked = True Then
            myp.ZDXLineStyle = Drawing2D.DashStyle.Dash
        ElseIf zdx_dashdot.Checked = True Then
            myp.ZDXLineStyle = Drawing2D.DashStyle.DashDot
        ElseIf zdx_dashdotdot.Checked = True Then
            myp.ZDXLineStyle = Drawing2D.DashStyle.DashDotDot
        ElseIf zdx_dot.Checked = True Then
            myp.ZDXLineStyle = Drawing2D.DashStyle.Dot
        ElseIf zdx_solid.Checked = True Then
            myp.ZDXLineStyle = Drawing2D.DashStyle.Solid
        End If
    End Sub

   
    Private Sub Button37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
        '装订线字体设置

        FontDialog1.Font = zdxtext.Font
        If FontDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            zdxtext.Font = FontDialog1.Font
            myp.ZDXFont = FontDialog1.Font
        End If
    End Sub

    Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
        '装订线文本颜色设置
        ColorDialog1.Color = zdxtext.ForeColor
        If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            zdxtext.ForeColor = ColorDialog1.Color
            myp.ZDXTextColor = ColorDialog1.Color
        End If
    End Sub

    Private Sub zdxlinecolor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zdxlinecolor.Click
        '装订线线条颜色
        ColorDialog1.Color = myp.ZDXLinecoLor
        If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            myp.ZDXLinecoLor = ColorDialog1.Color
            zdxlinecolor.ForeColor = myp.ZDXLinecoLor
        End If
    End Sub
End Class