Как напечатать строку в строке с несколькими строками?
private void MSPrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.DrawString("STOCK SUPPLIERS LIST REPORT", new Font("Arial", 14, FontStyle.Bold), Brushes.Black, new Point(290, 50)); e.Graphics.DrawString("Date: " + DateTime.Now.ToShortDateString(), new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 80)); e.Graphics.DrawString("Time: " + DateTime.Now.ToShortTimeString(), new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 110)); e.Graphics.DrawString("--------------------------------------------------------------------------" + "----------------------------------------------------------------", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 160)); e.Graphics.DrawString("Company", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 175)); e.Graphics.DrawString("Person ", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(140, 175)); e.Graphics.DrawString("Tel", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(270, 175)); e.Graphics.DrawString("Fax", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(380, 175)); e.Graphics.DrawString("Address", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(500, 175)); e.Graphics.DrawString("Email", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(650, 175)); e.Graphics.DrawString("--------------------------------------------------------------------------" + "----------------------------------------------------------------", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, 190)); int yPos = 205; int addrPos = 0; //int counter = 0; for (int i = numItemsPrintedSoFar; i < shoppingCart.Count; i++) { numItemsPerPage += 1; if (numItemsPerPage <= 25) { numItemsPrintedSoFar++; if (numItemsPrintedSoFar <= shoppingCart.Count) { e.Graphics.DrawString(shoppingCart[i].CompanyName, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(25, yPos+addrPos)); e.Graphics.DrawString(shoppingCart[i].ContactPerson, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(140, yPos + addrPos)); e.Graphics.DrawString(shoppingCart[i].Tel, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(270, yPos + addrPos)); e.Graphics.DrawString(shoppingCart[i].Fax, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(380, yPos + addrPos)); e.Graphics.DrawString(shoppingCart[i].Address, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(500, yPos + addrPos)); e.Graphics.DrawString(shoppingCart[i].Email, new Font("Arial", 10, FontStyle.Regular), Brushes.Black, new Point(650, yPos + addrPos)); yPos += 75; // counter += 1; } else { e.HasMorePages = false; } } else { numItemsPerPage = 0; e.HasMorePages = true; return; } } //addrPos = yPos+(25 * counter); e.Graphics.DrawString("--------------------------------------------------------------------------" + "----------------------------------------------------------------", new Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(25, yPos*3)); //reset variables numItemsPerPage = 0; numItemsPrintedSoFar = 0; //addrPos = 0; }
Что я уже пробовал:
я попытался пропустить увеличить точку так чтобы информация не печаталась поверх другой но это оставляет много места которое мне нравится