Help on PrintPage in C #

1

What processes to put a watermark (image) on the form that will be created by C #

  private void Imprimir_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {

        Font fonte = new Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);


        e.Graphics.DrawString(DateTime.Now.ToString("HH:mm:ss"), fonte, Brushes.Black, 20, 20);

        e.Graphics.DrawString("TESTE DE LABEL",fonte,Brushes.Black,20,150);

        e.Graphics.DrawString(textBox1.Text, fonte, Brushes.Black, 300, 250);


    }
    
asked by anonymous 29.12.2017 / 00:21

1 answer

0

I assume you're using PrintDocument .

PrintDocument printDoc = new PrintDocument(); 
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage); 

Then add Graphics there:

Graphics g = e.Graphics; 
g.TranslateTransform(200, 200); 
g.RotateTransform(e.PageSettings.Landscape ? 30 : 60); 
g.DrawString("DRAFT VERSION", new Font("Arial", 75, FontStyle.Bold), 
             new SolidBrush(Color.FromArgb(64, Color.Black)), 0, 0);
    
29.12.2017 / 09:17