Print and PrintPreview in C# Windows Application By Kumaran Kanniappan July 07, 2013 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 = printDocument1; if (printDialog1.ShowDialog() == DialogResult.OK) { printDocument1.Print(); } } // print preview button private void button2_Click(object sender, EventArgs e) { printPreviewDialog1.Document = printDocument1; printPreviewDialog1.ShowDialog(); } } } 3. Output Share Get link Facebook X Pinterest Email Other Apps Share Get link Facebook X Pinterest Email Other Apps Comments UnknownTuesday, 9 July 2013 at 08:17:00 GMT+5:30but how can someone link a windows application with login details to once websiteReplyDeleteRepliesKumaran KanniappanTuesday, 9 July 2013 at 11:34:00 GMT+5:30@ENOCH aMODU it's possible by adding web service& DLl Reference to windows applicationDeleteRepliesReplyReplyPHPFriday, 12 July 2013 at 15:00:00 GMT+5:30please provide how to generate multiple reports and individual like school erp and simple reporting actually i m facing problem with crystal report did you provide example refrenseReplyDeleteRepliesReplySercan YILMAZWednesday, 23 March 2016 at 19:01:00 GMT+5:30how to set page size?ReplyDeleteRepliesReplyUnknownWednesday, 6 September 2017 at 15:23:00 GMT+5:30how to print whole panel content in c#???ReplyDeleteRepliesReplyAdd commentLoad more... Post a Comment Share this to your friends
but how can someone link a windows application with login details to once website
ReplyDelete@ENOCH aMODU it's possible by adding web service& DLl Reference to windows application
Deleteplease provide how to generate multiple reports and individual like school erp and simple reporting actually i m facing problem with crystal report did you provide example refrense
ReplyDeletehow to set page size?
ReplyDeletehow to print whole panel content in c#???
ReplyDelete