cad sunny

cad sunny

  • NA
  • 138
  • 22.9k

print multi page continued margin

Sep 20 2014 3:25 AM
string strDisplay = "Printing Index";
            System.Drawing.Font fntString = new Font("Times New Roman", 28, FontStyle.Bold);
            e.Graphics.DrawString(strDisplay, fntString, Brushes.Black, 180, 100);


fntString = new System.Drawing.Font("Times New Roman", 8, FontStyle.Regular);
            e.Graphics.DrawString("Items" + "\n" + "--------------------------" + "\n" + textBox1.Text , fntString, Brushes.Black, 70, 590);

float linesPerPage = 0;
            float yPosition = 590;
            int count = 0;
            float leftMargin = 70;
            float topMargin = 590;
            string line = null;
            Font printFont = new System.Drawing.Font("Times New Roman", 8, FontStyle.Regular);
            SolidBrush myBrush = new SolidBrush(Color.Black);


            linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
            while (count < linesPerPage && ((line = myReader.ReadLine()) != null))
            {
                yPosition = topMargin + (count * printFont.GetHeight(e.Graphics));
                e.Graphics.DrawString(line, printFont, myBrush, leftMargin, yPosition, new StringFormat());
                count++;
            }

            if (line != null)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
                myBrush.Dispose();
            }


textbox1 content shown in first pages start top margin 590 and also print in second page also top margin is 590,i want first page top margin is 590 and second page contiuned to top position margin is 100 only not it 590 and 2nd page should be without Print Index Header


help me.