The list should be able to print all the items in the view, so that with the column name:
start : (Date) expiration: (date) shift: (change number) sales: (sale)
and it prints completely what I want, but this is only the first page (or the first 12 listings Lines of view. However, if I send a notification in a message box, it sends all the list view content, I do not understand this due to the print but I can not understand it.
Private Zero btnPrint_Click (Object Sender, EventArgs E) {PrintDialog PD = New PrintId (print), print Document MyPrintDocument = New Print Document (); MyPrintDocument.PrintPage + = New PrintPageEventHandler (this.PrintPageEvent); pd.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.Print ();}} Private Zero PrintPage Event (Object Sender, PrintPageEventArgs ev) {string text = null; For (int i = 0; i & lt; listView4.Items.Count; I ++) {text + = "Start:" + listView4.Items [i] .ext + Environment.NewLine + "End:" + listView4 Items [i] .SubItems [1]. Text + Environment.NewLine + "Shift Number:" + ListView4.Items [i] .SubItems [2]. Text + Environment. NewLine + "Total Sales:" + List View 4. ITEMS [i] .SubItems [3]. Text + environment. NewLine + "---- ------------------------" + Environment. new line; MessageBox.Show (text); Font mifant = new font ("ariel", 12); Ev.Graphics.DrawString ("------------------------------------" + Environment. NewLine + Text + EnvironmentalNewLine + "------------------------------------", MyFont, New SolidBrush (system Droping color black), (EvePabons. Left), Eve PagesBonds.Tap); }
Assigning you to PrintPageEventArgs.HasMorePages = true Should print multiple pages, therefore, in your case, you just have to do this ev.HasMorePages = true; PrintPageEventArgs.HasMorePages property - - Indicates whether any additional pages should be printed or not.
- returns
true if any additional pages should be printed; Otherwise, the false - is the default
false .
No comments:
Post a Comment