foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
e.HasMorePages = false;
if (row.Cells[0].Value != null && (e.PageSettings.PrintableArea.Height <= (y + 400)))
{
e.HasMorePages = true;
x = 40;
y = 210;
y2 = 256;
}
{
e.HasMorePages = false;
}
if (row.Cells[0].Value != null)
{
for (int j = this.dataGridView1.Columns.Count - 1; j > -1; j--)
{
if (j == 0)
w = 70;
else
w = 0;
DataGridViewCell cell; cell = row.Cells[j];
Rectangle rect = new Rectangle(x, y, cell.Size.Width + w, pictureBox3.Height );
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Center;
e.Graphics.DrawRectangle(Pens.Black, rect);
if (cell.Value != null ))
{
e.Graphics.DrawString(cell.Value.ToString(),
SystemFonts.DefaultFont, Brushes.Black, rect, sf);
}
x += rect.Width;
}
x = 40;
y += pictureBox3.Height;
}
}
برچسب: داکیومنت,
نویسنده: خنج