码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-09-10 14:20:56      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:print   文件名   class   file   vb.net   string   net   ack   wstring   

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打印指定文件-(目前是打印文件名)

标签:print   文件名   class   file   vb.net   string   net   ack   wstring   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!