vb新手,求一段打印程序代码~~~~~
新手学习用,谢谢,想设计一个这样的打印程序
现在
当程序运行时加载数据
Private Title As String Private Content As String Private IntArray(9) As Integer Private ImgArray(10) As Bitmap '这里我的想法是每张纸作为一个图片,但感觉不好,有没有简单的实现办法 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Title = "测试用例" Content = "今天是2011年11月10日" Dim x As Integer For x = 0 To 9 IntArray(x) = x Next '其中title和content打在一页上,IntArray作为页码打在每页上,即一共要打9页 '另外怎样转换像素和毫米单位,例如页码我想打印到每张a4纸的(10mm,20mm)位置 '字体怎么设置呢??例如:Title = "测试用例"想设置成小三加粗 '这里要怎样实现预览呢??求大大们贴点代码,包括上下翻页和直接转到指定页 End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click PrintDocument1.Print() End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim x As Integer For x = 0 To ImgArray.Length - 1 '打印每张图 e.Graphics.DrawImage(ImgArray(x), 0, 0) Next End Sub '这里怎么写??我这样必须连接打印机才能看出效果,我想直接先生成xps文件(打印预览文件是这个后缀吧,记不清了)这样方便调试