Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

How to print text using C#


  • This topic shows how to print text from TextBox or RichTextBox using C# programming.
  • Tools needed: Button1 (Button1), TextBox1 (TextBox1), PrintDocument1 (PrintDocument1).

PrintDocumentHow to print text using C# programming

  • The PrintDocument control defines the various methods that allow you to send output to the printer.
  • To incorporate printing functionality into your Windows application, you can either drag and drop the PrintDocument control onto your form, or create an instance of the PrintDocument class during runtime.
  • To start the printing process, use the Print() method of the PrintDocument object. To customize the printing process using the PrintDocument object, there are generally three events that you need to get acquainted with. They are:


  • BeginPrint Occurs when the Print() method is called and before the first page of the document prints. Typically, you make use of the BeginPrint event to initialize fonts, file streams, and other resources used during the printing process.
  •  PrintPage Occurs when the output to print for the current page is needed. This is the main event to code the logic required for sending the outputs to the printer.
  •  EndPrint Occurs when the last page of the document has printed. Typically, you use the EndPrint event to release fonts, file streams, and other resources used during the printing process, like fonts.

How to print text using C# programmingComplete Code

How to print text using C#


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">