WinForms – Print using printDialog and printDocument
Code snippet here:
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 WindowsFormsApplication2 { public partial class Form1 : Form { DataSet ds = new DataSet(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { printDialog1.Document = printDocument1; if (printDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { printDocument1.Print(); } } private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawString("test",new Font(FontFamily.GenericSerif,12), Brushes.Black,100,100); } } }
Related posts:























Leave a Reply
You must be logged in to post a comment.