" i can't give subtotal label fixed value like
new point (100,100)
because dgv rows changeable size depends in number of rows
how to add subtotal label after dgv rows ?
e.Graphics.DrawString(label51.Text.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, new Point(100, 100), format);
Here is my code:
e.Graphics.FillRectangle(Brushes.Yellow, new Rectangle(30, height, 60, dataGridView5.Rows[0].Height));
e.Graphics.DrawRectangle(p, new Rectangle(30, height, 60, dataGridView5.Rows[0].Height));
e.Graphics.DrawString(dataGridView5.Columns[9].HeaderText.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, new Rectangle(30, height, 60, dataGridView5.Rows[0].Height), stringFormat);
int Height1 = 0;
Height1 = 150;
while (i < dataGridView5.Rows.Count)
{
if (Height1 > e.MarginBounds.Height)
{
Height1 = 150;
e.HasMorePages = true;
return;
}
Height1 += dataGridView5.Rows[i].Height;
e.Graphics.DrawRectangle(p, new Rectangle(30, Height1, 60, dataGridView5.Rows[0].Height));
e.Graphics.DrawString(dataGridView5.Rows[i].Cells[9].FormattedValue.ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, new Rectangle(30, Height1, 60, dataGridView5.Rows[0].Height), stringFormat);
i++;
}
i = 0;
}
Here is what i want to get:
product_name || amount || price || total
----------------------------------------
clothes 1 45 45
shoes 2 12 24
----------------------------------------
total 69
discount 9
subtotal 60