private void btn_Print_Click(object sender, EventArgs e)
{
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(10, 80), new Point(370, 80));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(10, 100), new Point(370, 100));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(10, 300), new Point(370, 300));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(10, 320), new Point(370, 320));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(60, 80), new Point(60, 320));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(165, 80), new Point(165, 320));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(230, 80), new Point(230, 320));
e.Graphics.DrawLine(new Pen(Brushes.Black), new Point(310, 80), new Point(310, 320));
e.Graphics.DrawString("Rameshwar", new Font("Times New Roman", 12F), Brushes.Black, new PointF(10, 50));
e.Graphics.DrawString("Komal", new Font(" Times New Roman", 12F), Brushes.Black, new PointF(15, 80));
e.Graphics.DrawString("Vishal", new Font("Times New Roman", 12F), Brushes.Black, new PointF(70, 80));
e.Graphics.DrawString("Rahul", new Font("Times New Roman", 12F), Brushes.Black, new PointF(170, 80));
}
No comments:
Post a Comment