Print Datagridview
-
I've already done every article it's seem to be useful but can't fulfill my request. I've just wanted to print all of my data from my datagrid. I have code it can run but this result is far from my thinking here is code
private void button3_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
public void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), this.Size));
this.InvokePaint(dataGridView1, myPaintArgs);when i click on button3 it can print but show just only i can see from datagrid not all of datagrid Thank in advance !!!!
-
I've already done every article it's seem to be useful but can't fulfill my request. I've just wanted to print all of my data from my datagrid. I have code it can run but this result is far from my thinking here is code
private void button3_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
public void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics, new Rectangle(new Point(0, 0), this.Size));
this.InvokePaint(dataGridView1, myPaintArgs);when i click on button3 it can print but show just only i can see from datagrid not all of datagrid Thank in advance !!!!
Hi, printing is a rather complex issue. The overall picture is your app has to do the pagination, it has to decide how much data fits on a page (PrintPage event will fire once for every page), and you should set PrintEventArgs.HasMorePages true for all but the last page. Furthermore, you have to keep track of the printing progress and implement the PrintPage handler such that it delivers the data belonging on the page currently being printed. I don't have a simple example available, but there are lots of them on google. Maybe this one[^] can help you. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, printing is a rather complex issue. The overall picture is your app has to do the pagination, it has to decide how much data fits on a page (PrintPage event will fire once for every page), and you should set PrintEventArgs.HasMorePages true for all but the last page. Furthermore, you have to keep track of the printing progress and implement the PrintPage handler such that it delivers the data belonging on the page currently being printed. I don't have a simple example available, but there are lots of them on google. Maybe this one[^] can help you. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.