I have some paper forms that i want to print some labels on them.these papers have special size(24 cm * 14).so I made a panel(907 pixel * 529 pixel) and i put my labels on it(I converted cm to pixel and i put labels in the special parts of my panel).these labels are going to be printed in empty fields of my paper forms.but the problem is that, just the first form can be printed in the right style.others are printed in upper place of the form. I thought it may be because of I didn't give my panel and labels exact size in pixel. but i couldn't give my panel exact size in pixels,coz it doesn't accept pixels in decimal. any ideas?
this is a part of my code:
Code
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)Code
{Code
Pen blackPen = new Pen(Color.Black, 1);Code
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;Code
e.Graphics.DrawLine(blackPen, 188, 400, 302, 400);Code
e.Graphics.DrawRectangle(blackPen, 330, 319, 122, 55);Code
e.Graphics.DrawString(label20.Text, label20.Font, new SolidBrush(label20.ForeColor), label20.Location);Code
e.Graphics.DrawString(label21.Text, label21.Font, new SolidBrush(label21.ForeColor), label21.Location);Code
e.Graphics.DrawString(label23.Text, label23.Font, new SolidBrush(label23.ForeColor), label23.Location);Code
e.Graphics.DrawString(label24.Text, label24.Font, new SolidBrush(label24.ForeColor), label24.Location);Code
e.Graphics.DrawString(label25.Text, label25.Font, new SolidBrush(label25.ForeColor), label25.Location);Code
e.Graphics.DrawString(label26.Text, label26.Font, new SolidBrush(label26.ForeColor), label26.Location);Code
e.Graphics.DrawString(label27.Text, label27.Font, new SolidBrush(label27.ForeColor), label27.Location); }Code
System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument();Code
doc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);Code
PrintDialog PrintSettings = new PrintDialog(); PrintSettings.Document = doc;Code
PageSettings pgsetting = new PageSettings();Code
doc.Print();
Answers
Know the answer? Post it. Somebody with the same question will find it here.