ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] VB.NET ¦Lªí¾÷³]©w°ÝÃD

[µo°Ý] VB.NET ¦Lªí¾÷³]©w°ÝÃD

  1. Public Class myPrinter
  2.    Friend TextToBePrinted As String
  3.    Public Sub prt(ByVal text As String)
  4.       TextToBePrinted = text
  5.       Dim prn As New Printing.PrintDocument
  6.       Using (prn)
  7.          prn.PrinterSettings.PrinterName = "PrinterName"
  8.          AddHandler prn.PrintPage,
  9.             AddressOf Me.PrintPageHandler
  10.          prn.Print()
  11.          RemoveHandler prn.PrintPage,
  12.             AddressOf Me.PrintPageHandler
  13.       End Using
  14.    End Sub
  15.    Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
  16.       Dim myFont As New Font("Microsoft San Serif", 10)
  17.          args.Graphics.DrawString(TextToBePrinted, New Font(myFont, FontStyle.Regular), Brushes.Black, 50, 50)
  18.    End Sub
  19. End Class
½Æ»s¥N½X
·Q½Ð°Ý§ÚÀ³¸Ó¦p¦ó¤~¯à§â
prn.PrinterSettings.PrinterName = "PrinterName"
§ï¦¨
prn.PrinterSettings.PrinterName = TextBox1.Text
±`¸Õ¤F§ï¦ý³£¬O¿ù»~¥¼«Å§i?

¦^´_ 1# ¥q®{


    ¸Õ¸Õ¥ý§âtextbox1.text «Å§i¦¨string ¬Ý¬Ý

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

        ÀR«ä¦Û¦b : Ä@­n¤j¡B§Ó­n°í¡B®ð­n¬X¡B¤ß­n²Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD