17. september 2004 - 13:48
#1
Du skal bare gøre sådan her :
protected void ThePrintDocument_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs ev)
{
float linesPerPage = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
Font printFont = new Font("arial", 10f);
SolidBrush myBrush = new SolidBrush(Color.Black);
float Kolonne_1_Left = ev.MarginBounds.Width * 0.333f;
float Kolonne_2_Left = ev.MarginBounds.Width * 0.666f;
float Kolonne_3_Left = ev.MarginBounds.Width;
float Felt_1_fra_top = ev.MarginBounds.Height * 0.125f;
float Felt_2_fra_top = ev.MarginBounds.Height * 0.250f;
float Felt_3_fra_top = ev.MarginBounds.Height * 0.375f;
float Felt_4_fra_top = ev.MarginBounds.Height * 0.500f;
float Felt_5_fra_top = ev.MarginBounds.Height * 0.625f;
float Felt_6_fra_top = ev.MarginBounds.Height * 0.750f;
float Felt_7_fra_top = ev.MarginBounds.Height * 0.875f;
float Felt_8_fra_top = ev.MarginBounds.Height;
linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics);
//Kolonne 1
ev.Graphics.DrawString("Teddy Holm Roskvist", printFont, myBrush, Kolonne_1_Left, Felt_1_fra_top, new StringFormat());
ev.Graphics.DrawString("Nattergalvej 15, st th", printFont, myBrush, Kolonne_1_Left, (Felt_1_fra_top + printFont.GetHeight(ev.Graphics)), new StringFormat());
ev.Graphics.DrawString("8900 Randers", printFont, myBrush, Kolonne_1_Left, (Felt_1_fra_top + (2* printFont.GetHeight(ev.Graphics))), new StringFormat());
ev.Graphics.DrawString("Danmark", printFont, myBrush, Kolonne_1_Left, (Felt_1_fra_top + (3 * printFont.GetHeight(ev.Graphics))), new StringFormat());
ev.Graphics.DrawString(".250", printFont, myBrush, Kolonne_1_Left, Felt_2_fra_top, new StringFormat());
ev.Graphics.DrawString(".375", printFont, myBrush, Kolonne_1_Left, Felt_3_fra_top, new StringFormat());
ev.Graphics.DrawString(".500", printFont, myBrush, Kolonne_1_Left, Felt_4_fra_top, new StringFormat());
ev.Graphics.DrawString(".625", printFont, myBrush, Kolonne_1_Left, Felt_5_fra_top, new StringFormat());
ev.Graphics.DrawString(".750", printFont, myBrush, Kolonne_1_Left, Felt_6_fra_top, new StringFormat());
ev.Graphics.DrawString(".875", printFont, myBrush, Kolonne_1_Left, Felt_7_fra_top, new StringFormat());
ev.Graphics.DrawString("siddehøjde", printFont, myBrush, Kolonne_1_Left, Felt_8_fra_top, new StringFormat());
// Kolonne 2
ev.Graphics.DrawString("K2 .125", printFont, myBrush, Kolonne_2_Left, Felt_1_fra_top, new StringFormat());
ev.Graphics.DrawString(".250", printFont, myBrush, Kolonne_2_Left, Felt_2_fra_top, new StringFormat());
ev.Graphics.DrawString(".375", printFont, myBrush, Kolonne_2_Left, Felt_3_fra_top, new StringFormat());
ev.Graphics.DrawString(".500", printFont, myBrush, Kolonne_2_Left, Felt_4_fra_top, new StringFormat());
ev.Graphics.DrawString(".625", printFont, myBrush, Kolonne_2_Left, Felt_5_fra_top, new StringFormat());
ev.Graphics.DrawString(".750", printFont, myBrush, Kolonne_2_Left, Felt_6_fra_top, new StringFormat());
ev.Graphics.DrawString(".875", printFont, myBrush, Kolonne_2_Left, Felt_7_fra_top, new StringFormat());
ev.Graphics.DrawString("siddehøjde", printFont, myBrush, Kolonne_2_Left, Felt_8_fra_top, new StringFormat());
// Kolonne 3
ev.Graphics.DrawString("K3 .125", printFont, myBrush, Kolonne_3_Left, Felt_1_fra_top, new StringFormat());
ev.Graphics.DrawString(".250", printFont, myBrush, Kolonne_3_Left, Felt_2_fra_top, new StringFormat());
ev.Graphics.DrawString(".375", printFont, myBrush, Kolonne_3_Left, Felt_3_fra_top, new StringFormat());
ev.Graphics.DrawString(".500", printFont, myBrush, Kolonne_3_Left, Felt_4_fra_top, new StringFormat());
ev.Graphics.DrawString(".625", printFont, myBrush, Kolonne_3_Left, Felt_5_fra_top, new StringFormat());
ev.Graphics.DrawString(".750", printFont, myBrush, Kolonne_3_Left, Felt_6_fra_top, new StringFormat());
ev.Graphics.DrawString(".875", printFont, myBrush, Kolonne_3_Left, Felt_7_fra_top, new StringFormat());
ev.Graphics.DrawString("siddehøjde", printFont, myBrush, Kolonne_3_Left, Felt_8_fra_top, new StringFormat());
myBrush.Dispose();
}