How can i setting page of lines and texts by C#

  • Thread starter Thread starter Abdul Aziz Al Ghamdi
  • Start date Start date
A

Abdul Aziz Al Ghamdi

Guest
hello evry body


Iwant to ask your them about :

How can i setting lines and texts of multi page inside margins by C#

i can generate lines and text by GDI+ on multi page but the problem all lines and text not setting inside page margins

look at picture :

https://social.msdn.microsoft.com/Forums/getfile/313112


and this is code :


Pen mypen = new Pen(Brushes.Black, 1);
Font FntStrng = new Font("tahoma", 10);
Font FntStrlog = new Font("arial", 14);
StringFormat format = new StringFormat(StringFormat.GenericTypographic);

dc.DrawRectangle(mypen, 20, 258, 750, 22);
dc.DrawString("NUM", FntStrng, Brushes.Black, 35, 261);
//dc.DrawLine(mypen, 75, 280, 75, 258);
dc.DrawString("PART NUMBER", FntStrng, Brushes.Black, 85, 261);
//dc.DrawLine(mypen, 480, 280, 480, 258);
dc.DrawString("DESCERPTIONS", FntStrng, Brushes.Black, 495, 261);
//dc.DrawString("A S M TECHNOLOGIY CO LTD", FntStrlog, Brushes.Black,40, 90);
dc.DrawLine(mypen, 15, 990, 785, 990);
//dc.DrawString("A S M TECHNOLOGIY CO LTD TEL:6391109 FAX:6391100 ",FntStrlog, Brushes.Black, 35, 1002);

//dc.SetClip(rg, CombineMode.Replace);



foreach (CustomDrawLine df in drawline)
{
lock (dc)
{




dc.TranslateTransform(0, -Addpage * printableArea.Height ,MatrixOrder.Append);
dc.DrawLine(df.pen1, df.X, df.Y, df.DW, df.DH);
dc.ResetTransform();

}
}

foreach (DrawingString tds in drawstring)
{
lock (dc)
{

dc.TranslateTransform(0, -Addpage * printableArea.Height ,MatrixOrder.Append);
dc.DrawString(tds.Text, FntStrng, tds.Brush, tds.X, tds.Y, format);
dc.ResetTransform();

}
}



dc.Dispose();


and thid code for button click


// draw lines on PnlReport .
CustomDrawLine ln1 = new CustomDrawLine(mypenV, (float)20, (float)ra,(float)770, (float)ra, PnlReport);
selectline = ln1;
// add the draw line on PnlReport.
drawline.Add(ln1);
//---------------------
CustomDrawLine ln2 = new CustomDrawLine(mypenV, (float)20, (float)ra - 20,(float)20, (float)ra, PnlReport);
selectline = ln2;
// add the draw line on PnlReport.
drawline.Add(ln2);

CustomDrawLine ln3 = new CustomDrawLine(mypenV, (float)75, (float)ra - 20,(float)75, (float)ra, PnlReport);
selectline = ln3;
// add the draw line on PnlReport.
drawline.Add(ln3);

CustomDrawLine ln4 = new CustomDrawLine(mypenV, (float)480, (float)ra - 20,(float)480, (float)ra, PnlReport);
selectline = ln4;
// add the draw line on PnlReport.
drawline.Add(ln4);

CustomDrawLine ln5 = new CustomDrawLine(mypenV, (float)770, (float)ra - 20,(float)770, (float)ra, PnlReport);
selectline = ln5;
// add the draw line on panel1.
drawline.Add(ln5);
//-----------------------------------------------------------------------------------------------------------------

// draw strings .

DrawingString ds = new DrawingString(textBox2.Text, Color.Black, (float)ja,(float)ra - 20, PnlReport);
selectstring = ds;
drawstring.Add(ds);

DrawingString ds1 = new DrawingString(textBox4.Text, Color.Black,(float)85, (float)ra - 20, PnlReport);
selectstring = ds1;
drawstring.Add(ds1);

DrawingString ds2 = new DrawingString(textBox5.Text, Color.Black,(float)488, (float)ra - 20, PnlReport);


selectstring = ds2;
drawstring.Add(ds2);


please

can any help me


best regard & thank you

Continue reading...
 
Back
Top