Hey!
I'm doning my thesis work right now and I'm programming in C# (for the first time). I want to print multiple pages (2 or 3) but I don't know how. I've searched and found some info but I think my problem is a bit different. I'm not printing from a textbox, txt-file or datebase. I'm "designing" the printed page by hand (or code) since I wanna print some pictures, lines, rectangles and different variables on specific locations. I've managed to design the first page but I wanna do another one that looks similar but with different images and variables.
Does anyone have a clue of how I should do it??
Here's the code for the "handmade" first page:
void printDoc_PrintPage(object sender, PrintPageEventArgs e)
{
string customerInfo1 = customerBox1.Text.ToString();
string customerInfo2 = customerBox2.Text.ToString();
string customerInfo3 = customerBox3.Text.ToString();
string customerInfo4 = customerBox4.Text.ToString();
string customerInfo5 = customerBox5.Text.ToString();
string customerInfo6 = customerBox6.Text.ToString();
Image photo = springDraw.springBitmap();
Pen myPen = new Pen(Brushes.Black, 1);
// Lesjöfors logotype
e.Graphics.DrawImage(Image.FromFile("C:\\Andreas\\GSCP3\\GSCP3\\logotype_large.gif"), 170, 20);
// Picture of the lid
e.Graphics.DrawImage(photo, 60, 153, 670, 670);
// Drawing of the rectangle
e.Graphics.DrawRectangle(myPen, 45, 150, 700, 880);
// Horizontal Line Under Lid Picture
e.Graphics.DrawLine(myPen, 45, 823, 745, 823);
// Spring Info
e.Graphics.DrawString("PROPOSAL", verdana10Font, Brushes.Black, 75, 825);
// Line under PROPOSAL
e.Graphics.DrawLine(myPen, 77, 840, 155, 840);
e.Graphics.DrawString("Gas Spring Dimension", verdana10Font, Brushes.Black, 75, 845);
e.Graphics.DrawString(chosenSpring, verdana10Font, Brushes.Black, 280, 845);
e.Graphics.DrawString("Catalogue Number", verdana10Font, Brushes.Black, 75, 865);
e.Graphics.DrawString("xxx", verdana10Font, Brushes.Black, 280, 865);
e.Graphics.DrawString("End Fitting, Tube", verdana10Font, Brushes.Black, 75, 885);
e.Graphics.DrawString("xxx", verdana10Font, Brushes.Black, 280, 885);
e.Graphics.DrawString("End Fitting, Rod", verdana10Font, Brushes.Black, 75, 905);
e.Graphics.DrawString("xxx", verdana10Font, Brushes.Black, 280, 905);
e.Graphics.DrawString("Mounting Point, Fixed [mm]", verdana10Font, Brushes.Black, 75, 925);
e.Graphics.DrawString("X= " + springFixX.ToString() + ", Y= " + springFixY.ToString(), verdana10Font, Brushes.Black, 280, 925);
e.Graphics.DrawString("Mounting Point, Lid [mm]", verdana10Font, Brushes.Black, 75, 945);
e.Graphics.DrawString("X= " + springLidClosedX.ToString() + ", Y= " + springLidClosedY.ToString(), verdana10Font, Brushes.Black, 280, 945);
e.Graphics.DrawString("Length Of Lid [mm]", verdana10Font, Brushes.Black, 75, 965);
e.Graphics.DrawString(lidLengthInt.ToString(), verdana10Font, Brushes.Black, 280, 965);
e.Graphics.DrawString("Weight Of Lid [kg]", verdana10Font, Brushes.Black, 75, 985);
e.Graphics.DrawString(weight.ToString(), verdana10Font, Brushes.Black, 280, 985);
e.Graphics.DrawString("Needed Forcein Pos. 2 [N]", verdana10Font, Brushes.Black, 75, 1005);
e.Graphics.DrawString(maxForceInt.ToString(), verdana10Font, Brushes.Black, 280, 1005);
// Vertical Line Left Of Customer Info
e.Graphics.DrawLine(myPen, 465, 823, 465, 1030);
// Customer Info
e.Graphics.DrawString("CUSTOMER INFO", verdana10Font, Brushes.Black, 470, 825);
// Line under PROPOSAL
e.Graphics.DrawLine(myPen, 473, 840, 595, 840);
e.Graphics.DrawString("Company", verdana10Font, Brushes.Black, 470, 845);
e.Graphics.DrawString("Name", verdana10Font, Brushes.Black, 470, 865);
e.Graphics.DrawString("Project", verdana10Font, Brushes.Black, 470, 885);
e.Graphics.DrawString("Fax", verdana10Font, Brushes.Black, 470, 905);
// Designer Info
e.Graphics.DrawString("Designed By", verdana10Font, Brushes.Black, 470, 965);
e.Graphics.DrawString("Tel. Nr.", verdana10Font, Brushes.Black, 470, 985);
e.Graphics.DrawString("Mail", verdana10Font, Brushes.Black, 470, 1005);
// Line
e.Graphics.DrawLine(myPen, 45, 1035, 745, 1035);
// Lesjöfors Address
e.Graphics.DrawString("Postal Address", verdana9Font, Brushes.Black, 45, 1040);
e.Graphics.DrawString("Telephone", verdana9Font, Brushes.Black, 330, 1040);
e.Graphics.DrawString("Telefax", verdana9Font, Brushes.Black, 530, 1040);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 45, 1055);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 45, 1070);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 330, 1070);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 530, 1070);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 45, 1085);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 330, 1085);
e.Graphics.DrawString("xxx", verdana9Font, Brushes.Black, 530, 1085);
}
Thanks in advance!
Andreas