printing problem
i have to Make a GridView with print option (Inherit the GridView control and add a print method). The print button should print all the rows in the gridview. There should an option to print no of rows perpage.
. i have to use GDI printing APIs for printing.
Posted May 9, 2009, 12:55 PM
you can use this code to print your list view content
if
(Controls[i].GetType() == this.listView1.GetType()){
for (int row = 0; row < listView1.Items.Count; row++){
int nextColumnPosition = listView1.Bounds.X; for (int col = 0; col < listView1.Items[row].SubItems.Count; col++){
g.DrawString(listView1.Items[row].SubItems[col].Text, listView1.Items[row].Font,
Brushes.Black, (nextColumnPosition + 3) * scalex, (listView1.Items[row].Bounds.Y + listView1.Bounds.Y) * scaley, new StringFormat());nextColumnPosition += listView1.Columns[col].Width;
}
}
}