473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
I wrote some C# functions that output a List of System.Drawing. Graphics (List<System.Dr awing.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(objec t sender, System.Drawing. Printing.PrintP ageEventArgs 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 1061

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

Similar topics

6
6143
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 my mappings between named colors, HEX values and the Long Integer values used in Access are not jibbing. Anyone have a nice list laying around? Danny J Lesandrini dlesandrini@hotmail.com
1
1415
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 protected methods. I pass into the constructor a custom Label object that contains the layout and data and has rendering code. public LabelPrint(Label label) : base() { this.label = label; }
4
13103
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 with a PrintPreviewControl and it shows me all the pages, but I still don´t know how to make them print. Thank you all Marcos
3
2212
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. But while trying to insert a text box to see when a method is used, and putting a counter to bump some variable? The textbox sits there unchanged. I put a breakpoint at the text write
5
6451
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 at a time. But it is printing front side on one card and back side on second card. I want to print both sides in a same card.
24
2825
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 with the printer that i am printing to(Zebra TLP2844). When i open Word and look at the fonts available for the default printer, it does not show the fonts i want. If i cahnge the printer to the printer that
1
8657
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 get only the part of the panel that is visible. for example in excel sheet we can get the whole sheet content even it is in minimized condition. but at point copyFromScreen(), i get the picture of the parts of panel theta is visible and other...
16
4511
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 screen, when I open a file, the entire contents of the file is in fact being shown...so why can't I print it later? All of this code I am getting from a book (Chris Sells) and the net. The solution is to be found in the fact that stringbuilder is...
9
3121
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 the printer dialog box. If I click OK (to print), the printer will print an empty paper. How can I use this code to print a file? I would apprciate it if you could help.
0
7870
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6639
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5732
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5400
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.