Quantcast
Viewing all articles
Browse latest Browse all 12583

Prints

Hello,

One part of a form called Notes is not printed when I print the screen. The image hereunder is a part of the display.

object: notes System.Windows.Forms.RichTextBox.Lines

Lines are not printed but the box is.

One can help please?

Image may be NSFW.
Clik here to view.

            //Evenement impression

            myPrintDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDoc_PrintPage);

     #region Impression


        void bpPrint_Click(object sender, EventArgs e)
        {
            //Affichage fenetre reglages impression
            PageSetupDialog pageSetupDialog = new PageSetupDialog();
            pageSetupDialog.Document = myPrintDoc;


            if (pageSetupDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //Recuperation des reglages
                myPrintDoc.DefaultPageSettings = pageSetupDialog.PageSettings;


                //Initialisation fenetre impression
                PrintDialog printDialog = new PrintDialog();
                printDialog.Document = myPrintDoc;


                //Impression
                if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    printDialog.Document.Print();
                }
            }
        }


        void myPrintDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            //Initialisation outils
            Pen myPen = new Pen(Color.Black, 1);
            Font myFontTitre = new System.Drawing.Font(FontFamily.GenericSansSerif, 16);
            Font myFontTexte = new System.Drawing.Font(FontFamily.GenericSansSerif, 12);


            //Format A4 = 8.27 x 11.70 pouces


            //Création de l'image
            int x = SystemInformation.WorkingArea.X;
            int y = SystemInformation.WorkingArea.Y;
            int width = this.Width;
            int height = this.Height;
            //
            Rectangle bounds = new Rectangle(x, y, width, height);
            Bitmap img = new Bitmap(width, height);
            tableLayoutPanel1.DrawToBitmap(img, bounds);


            //Ajout de l'image dans le document a imprimer
            Point p = new Point();
            e.Graphics.DrawImage(img, p);
        }


        #endregion


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>