473,385 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Print out a List of Graphics in C# Windows Form App

I wrote some C# functions that output a List of System.Drawing.Graphics (List<System.Drawing.Graphics>) objects. they then return the List to a PrintDocument object which I want to have print out each item in the list as a page in a multipage print job. For some reason the first page prints out fine but each successive page comes out blank. Here is my print page event code.

Graphics ReportLayout;
List<Graphics> g = new List<Graphics>();

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
ReportLayout = e.Graphics;

float leftMargin = e.MarginBounds.Left / 100;
float rightMargin = e.MarginBounds.Right / 100;
float topMargin = e.MarginBounds.Top / 100;
float bottomMargin = e.MarginBounds.Bottom / 100;
float width = e.MarginBounds.Width / 100;
float height = e.MarginBounds.Height / 100;

//Make Pages only once
if (pagesmade == false)
{
//returns a List<Graphics>
g = RT.WriteReport(e);
pagesmade = true;
}

//if pages remain there are more pages to print
if (iterate < g.Count-1)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}

ReportLayout = g[iterate];

iterate++;
}

I'm kind of at a loss any suggestions would be greatly appreciated.
Sep 23 '08 #1
0 1051

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
1
by: Ian Shimmings | last post by:
I have implemented some label printing code that prints to a (you guessed it) label printer. I have derived my class from the System.Drawing.Printing.PrintDocument class ond overriden some of the...
4
by: Marcos Beccar Varela | last post by:
Hello to all, I have this form with a PrintDocument named prt_doc, theproblem is that when I invoke the prt_doc.print() it only prints the las page, and not multiple pages. I Also Have a Preview...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
5
by: Raman | last post by:
Hello friends, I want to print an ID card. I have one Windows Form that contains front and back side. The printer is printing both front and back side at a time. I am trying to send both sides...
24
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available...
1
by: radhikabista | last post by:
my windows application form is divided into 3 split containers or split panels now what is my problem is i need to print the contents of the middle one container even if it is not seen full. but i...
16
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the...
9
by: Autostrad | last post by:
Hi everybody, I need your help. The code below is good if I want to print a sketch. The book did not show how to print a simple text file. Right now if I run this program (as is)it will show...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.