2011年11月24日 星期四

一般印表機直接列印

參考 引用:
--
 Imports   System
Imports   System.Drawing
Imports   System.Drawing.Drawing2D
Imports   System.Drawing.Printing  

  Private   WithEvents   printdoc   As   New   Printing.PrintDocument
  Private   Sub   printdoc_PrintPage(ByVal   sender   As   Object,   ByVal   e   As   System.Drawing.Printing.PrintPageEventArgs)   Handles   printdoc.PrintPage

      Dim   g   As   Graphics   =   e.Graphics
                Dim   pen   As   New   Drawing.Pen(Color.Black,   3)
                Dim   strfont1   As   String   =   "黑体 "   'arial
                Dim   font   As   New   Font(strfont1,   16,   FontStyle.Bold)
                g   =   e.Graphics
                'draw   page   title

                g.DrawString( "一般印表機直接列印",   font,   Brushes.Black,   330,   140)
        End   Sub

Public   Sub   printing()
                  Dim   printDlg   As   New   System.Windows.Forms.PrintDialog()
                  printDlg.Document   =   printdoc
                  If   printDlg.ShowDialog   =   DialogResult.OK   Then
                        printdoc.Print()
                  End   If
End   Sub

Public   Sub   print() 

              printdoc.Print()
              
        End   Sub
Public   Sub   printpreviewer   ()
                  Dim   printviewer   As   New   System.Windows.Forms.PrintPreviewDialog()
                printviewer.Document   =   printdoc
                printviewer.SetBounds(0,   0,   768,   1024)
                printviewer.ShowDialog()
End   Sub

沒有留言:

張貼留言