2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by JuhaW
0

I have developed shareware program where it is possible to draw form and reports, then print it out.

Small sample from it
I was copied some lines from my software, and hoping it is workable and understandable.

using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
namespace xxx 
{
        public void PRINTOUT()
        {
            PrintDialog pd = new PrintDialog();
            pd.Document = new PrintDocument();
     
            if (pd.ShowDialog() == DialogResult.OK)
            {
                pd.Document.PrintPage += new PrintPageEventHandler (PrintPage);            
                pd.Document.Print();
            }
         }
         private void PrintPage(object sender, PrintPageEventArgs ev)
         {
              ev.Graphics.DrawString("* * Header * * ", Font, Brushes.Black, 100, 100);     //Print header text, Font has been
                                                                                            //defined elsewhere (in form ?)
              ev.HasMorePages=false;                                                       // Last Page (1 page)
         }
 }

Edited by JuhaW: Not finished

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.