首页 > Web开发 > 详细

VB.net打印指定文件-(目前是打印文件名)

时间:2017-09-10 14:10:44      阅读:426      评论:0      收藏:0      [点我收藏+]
Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        OpenFileDialog1.ShowDialog()
        TextBox1.Text = OpenFileDialog1.FileName
        

        
        ‘PrintDocument1.Print()
        print()
    End Sub

    Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

        e.Graphics.DrawString(TextBox1.Text, New Font("宋体", 20), New Pen(Color.Black, 1).Brush, 30, 30)
        e.Graphics.FillRectangle(Brushes.Blue, New Rectangle(500, 500, 500, 500))
       
    End Sub
    Sub print()

        Dim printdialog1 As New PrintDialog()
        ‘printdialog1.ShowDialog()
        ‘PrintDocument1 = OpenFileDialog1.FileName.ToString
        PrintDialog1.Document = PrintDocument1
        Dim rusult As DialogResult = printdialog1.ShowDialog()
        If rusult = DialogResult.OK Then
            PrintDocument1.Print()

        End If
    End Sub
End Class

  

VB.net打印指定文件-(目前是打印文件名)

原文:http://www.cnblogs.com/qobin/p/7500881.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!