3
Answers

Printing, textoxes and another page.

Lukas Hosek

Lukas Hosek

14y
10.7k
1
Hi,
I have a problem with create new printpage.

 
            printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
            PrintPreviewDialog dlg = new PrintPreviewDialog();
            dlg.Document = printDoc;
            dlg.ShowDialog();


---
private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)
        {
Font font_z = new Font("Courier New", 12);
            StringFormat format_z = new StringFormat();
            format_z.Alignment = StringAlignment.Near;
            format_z.LineAlignment = StringAlignment.Near;

 e.Graphics.DrawString("BOLD TEXT:  (from TEXTBOX)", new Font(font_z, FontStyle.Bold), Brushes.Black, 50, 50, format_z);

e.Graphics.DrawString("normal text (from TEXTBOX)", font_z, Brushes.Black, 50, 70, format_z);

e.Graphics.DrawString("BOLD TEXT:  (from TEXTBOX)", new Font(font_z, FontStyle.Bold), Brushes.Black, 50, 100, format_z);


Is some better code?
I have more textboxes and positioning of each line is terrible.

AND
how to get another textbox on another page?

Thanks Lukas
Answers (3)