Click here to Skip to main content
15,905,420 members

Comments by Peter M. Adeeb (Top 23 by date)

Peter M. Adeeb 4-Jan-16 10:53am View    
that's it
now you got me
can you give me sample code to trace last row and then draw subtotal label ??
Peter M. Adeeb 4-Jan-16 10:45am View    
thanks @ryandev for respond
i want to draw subtotal label in print document after drawing dgv rows
the problem i can't give subtotal label fixed value like
new point (100,100)
because dgv rows changeable size dependes in number of rows
i hope you understood me
i'm sorry for my bad english

Peter M. Adeeb 4-Jan-16 10:27am View    
i'm asking how ???
Peter M. Adeeb 4-Jan-16 10:13am View    
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;
}
Peter M. Adeeb 4-Jan-16 10:07am View    
the problem is here
i can't give label fixed location in print document like that(( new Point(100, 100) ))
because dgv hasn't fixed number of rows
i want to add subtotal label after last row of dgv in print document