Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MyrefResh()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MyrefResh()
    End Sub
    Private Sub MyrefResh()
        myp.PageUnits = VBprinter.VB2008Print.PageExportUnit.CentiMeter
        myp.NewDoc()
        myp.NewPage()
        Dim colwidth(0 To 5) As Single
        Dim rowheight1 As Single
        Dim rowheight2 As Single
        Dim myborder As String = "6666"
        rowheight1 = 500
        rowheight2 = 80
        colwidth(0) = 400
        colwidth(1) = 160
        colwidth(2) = 160
        colwidth(3) = 160
        colwidth(4) = 400
        colwidth(5) = 600
        Dim f1 As New Font("宋体", 12)
        Dim f2 As New Font("华文行楷", 12, FontStyle.Bold)
        Dim mywidth1 As Single
        mywidth1 = colwidth(0) + colwidth(1) + colwidth(2) + colwidth(3)
        Dim mywidth2 As Single
        mywidth2 = colwidth(4) + colwidth(5)
        Dim centerx As Single
        centerx = (myp.PaperPrintWidth - mywidth1 - mywidth2) / 2
        myp.Currentx = centerx '左右居中打印
        
        Dim ss As String
        ss = vbCrLf & "和田市宏达客运有限公司"
        Dim curx As Single
        Dim cury As Single
        myp.DrawCell(ss, mywidth1, rowheight1, New Font("黑体", 15, FontStyle.Bold), myborder, Color.Black, StringAlignment.Center, StringAlignment.Near, True, False, False, False, 0, 0)
        curx = myp.Currentx
        cury = myp.Currenty

        myp.Currentx = centerx + mywidth1 / 4
        myp.Currenty = myp.Currenty + rowheight1 / 4
        myp.DrawCellImage(PictureBox1.Image, myp.Currentx, myp.Currenty, mywidth1 / 2, rowheight1 / 3 * 2, "0000", True, StringAlignment.Center, StringAlignment.Center)


        myp.Currentx = centerx
        myp.Currenty = cury
        myp.DrawCell("工  作  证", mywidth1 / 4, rowheight1, New Font("黑体", 15), "0000", Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, True, 0, 0)


        myp.Currentx = curx
        myp.Currenty = cury
        myp.DrawCellImage(PictureBox2.Image, myp.Currentx, myp.Currenty, mywidth2, rowheight1, myborder, True, StringAlignment.Center, StringAlignment.Center)
        myp.NewRow(rowheight1)
        myp.Currentx = centerx
        myp.DrawCell(TextBox1.Text, mywidth1, rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("新R13323", mywidth2, rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.NewRow(rowheight2)
        myp.Currentx = centerx
        myp.DrawCell("身份证号", colwidth(0), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("314341234214342134343", colwidth(1) + colwidth(2) + colwidth(3), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("营运证号", colwidth(4), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("65320002129", colwidth(5), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)



        myp.NewRow(rowheight2)
        myp.Currentx = centerx
        myp.DrawCell("驾驶证号", colwidth(0), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("", colwidth(1) + colwidth(2) + colwidth(3), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("开业日期", colwidth(4), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("2013年10月8日", colwidth(5), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)


        myp.NewRow(rowheight2)
        myp.Currentx = centerx
        myp.DrawCell("从业资格证号", colwidth(0), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("44345353453534545", colwidth(1) + colwidth(2) + colwidth(3), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("厂牌", colwidth(4), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("奇瑞", colwidth(5), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)


        myp.NewRow(rowheight2)
        myp.Currentx = centerx
        myp.DrawCell("从业资格范围", colwidth(0), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("客运", colwidth(1), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("领证日期", colwidth(2), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("2014年1月1日", colwidth(3), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("座位数", colwidth(4), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("10", colwidth(5), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)

        myp.NewRow(rowheight2)
        myp.Currentx = centerx
        myp.DrawCell("驾驶证领证日期", colwidth(0), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("未智", colwidth(1), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("准驾车型", colwidth(2), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("飞机", colwidth(3), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("营运路线", colwidth(4), rowheight2, f1, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)
        myp.DrawCell("长沙到北京", colwidth(5), rowheight2, f2, myborder, Color.Black, StringAlignment.Center, StringAlignment.Center, True, False, False, False, 0, 0)


        myp.NewRow(rowheight2 * 1.5)
        myp.DrawTitle("宏达公司服务电话：0731-52541256551 df2343234", New Font("宋体", 16), Color.Blue, 0)
        myp.EndDoc()
    End Sub
End Class
