Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

PrintForm.Print Scrollable don't print all scroll.

$
0
0

Hello Guys! How are you ?
I'm printing my form using Visual Basic Power Pack Print Form. On methodPrint() i use the second overload:

printForm1.Print(this, Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.PrintOption.Scrollable);

But the result is this (one page, because is max of my screen):

 int nItens = 29;
        int nItemHeight = 0;
        int nItemWidth = 0;
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Width = printForm1.PrinterSettings.DefaultPageSettings.PaperSize.Width;
            //this.Height = printForm1.PrinterSettings.DefaultPageSettings.PaperSize.Height;

            for (int i = 0; i < nItens; i++)
            {
                var item = new ItemDestinatario();
                item.ID = (i + 1);
                var top = item.Height * i;
                nItemHeight = item.Height;
                nItemWidth = item.Width;

                item.Top = top;
                item.Width = printForm1.PrinterSettings.DefaultPageSettings.PaperSize.Width -20;
                
                this.Controls.Add(item);
            }

            var h = this.Height;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var i = this.AutoScrollMargin.Height;
            printForm1.DocumentName = "Printing test";

            this.Height = nItemHeight * nItens;

            printForm1.PrinterSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(10, 10, 10, 10);
            printForm1.PrintAction = System.Drawing.Printing.PrintAction.PrintToPreview;
            
            printForm1.Print(this, Microsoft.VisualBasic.PowerPacks.Printing.PrintForm.PrintOption.Scrollable);
        }

See, my content is dinamyc.

Thanks all!

Lucas Argate


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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