Printing
-
I use this code for printpage:
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int x = e.MarginBounds.Left+70;
int y = e.MarginBounds.Top;
try
{
for (int i=0;i<100;i++)
{
e.Graphics.DrawString( i.ToString(), new Font("Arial", 10), Brushes.Red, x, y);
y+=15;
if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
}
e.HasMorePages = false;
}
catch(Exception myE)
{
MessageBox.Show("Problem!!" + myE.ToString());
}}
The problem is now I don't have two page from 1 to 100,my both pages in printpreview are the same and it draw second page the same as first one,not proceed it. I hope it is clear. Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975 -
I use this code for printpage:
private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int x = e.MarginBounds.Left+70;
int y = e.MarginBounds.Top;
try
{
for (int i=0;i<100;i++)
{
e.Graphics.DrawString( i.ToString(), new Font("Arial", 10), Brushes.Red, x, y);
y+=15;
if (y >= e.MarginBounds.Bottom)
{
e.HasMorePages = true;
return;
}
}
e.HasMorePages = false;
}
catch(Exception myE)
{
MessageBox.Show("Problem!!" + myE.ToString());
}}
The problem is now I don't have two page from 1 to 100,my both pages in printpreview are the same and it draw second page the same as first one,not proceed it. I hope it is clear. Thanks Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975isn't that function called each time you print a page? and it is starting each time with i=0. so it appears correct to me, that each page looks the same. in fact: i'm wondering why it doesn't print infinitely when printing the second page, you should start the i-loop where the one for the first page stopped. ...but i'm new to c# and the corresponding class library...:rolleyes: :wq
-
isn't that function called each time you print a page? and it is starting each time with i=0. so it appears correct to me, that each page looks the same. in fact: i'm wondering why it doesn't print infinitely when printing the second page, you should start the i-loop where the one for the first page stopped. ...but i'm new to c# and the corresponding class library...:rolleyes: :wq
Rüpel wrote: isn't that function called each time you print a page? and it is starting each time with i=0. so it appears correct to me, that each page looks the same. Yes,I know it and I beleive you are right,but how can I solve it,my code is just simple example,in more complecated text its not like this. Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975