Skip to main content

Posts

Showing posts from July 7, 2013

Print and PrintPreview in C# Windows Application

In this article; we gonna see how to make print and preview options in C# windows application 1. Design View of the windows Form 2. Code using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace PrintOptions { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //printdocument associated with richTextbox value private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawString(richTextBox1.Text, richTextBox1.Font, Brushes.Black, 100, 20); e.Graphics.PageUnit = GraphicsUnit.Inch; } // print button private void button1_Click(object sender, EventArgs e) { printDialog1.Document = printDocu...