Hi All,
Now i use the following code to print the data in C# 2005 application.
But i face the problem is total page number at the begining of first page. They want to get page number like : Page : 1 of 15.
Is there any suggesting how to get total page number. - Public int y = 0;
-
Public int LineCount = 0;
-
int yPosition = 50;
-
e.Graphics.DrawString("Summary of Image Data", drawHeaderFont, drawBrush, 50, yPosition, drawFormat);
-
-
yPosition = yPosition + 30;
-
e.Graphics.DrawString("Category", drawFont, drawBrush, 50, yPosition, drawFormat);
-
e.Graphics.DrawString("No. of Image", drawFont, drawBrush, 260, yPosition, drawFormat);
-
e.Graphics.DrawString("Percentage", drawFont, drawBrush, 360, yPosition, drawFormat);
-
-
int DListCount = Convert.ToInt32(lsvSummary.Items.Count.ToString());
-
yPosition = yPosition + 30;
-
-
while (LineCount1 < DListCount)
-
{
-
e.Graphics.DrawString(ListView1.Items[y].SubItems[1].Text.ToString(), drawFont2, drawBrush, 50, yPosition, drawFormat);
-
e.Graphics.DrawString(ListView1.Items[y].SubItems[2].Text.ToString(), drawFont2, drawBrush, 280, yPosition, drawFormat);
-
e.Graphics.DrawString(ListView1.Items[y].SubItems[3].Text.ToString(), drawFont2, drawBrush, 380, yPosition, drawFormat);
-
-
yPosition = yPosition + 30;
-
LineCount1++;
-
y++;
-
-
if (yPosition >= e.MarginBounds.Bottom)
-
{
-
e.HasMorePages = true;
-
break;
-
}
-
else
-
{
-
e.HasMorePages = false;
-
}
-
}
-
e.Graphics.DrawString("Print Date Time : " + DateTime.Now.ToString(), drawFont2, drawBrush, 50, e.PageBounds.Bottom - 50, drawFormat);
-
e.Graphics.DrawString("Page : " + PageCount + " of " + TotalPage, drawFont2, drawBrush, e.PageBounds.Right - 150, e.PageBounds.Bottom - 50, drawFormat);
-
PageCount = PageCount + 1;
Many Thanks
I think there is no other way but to process the whole document before printing to calculate the number of pages. Since you are using fixed increments (e.g. yPosition = yPosition + 30;), it should be easy to implement.
2 11213
I think there is no other way but to process the whole document before printing to calculate the number of pages. Since you are using fixed increments (e.g. yPosition = yPosition + 30;), it should be easy to implement.
@vekipeki
Anyway, thank a lot vekipeki .....
I try this way .........
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jody Gelowitz |
last post by:
I am having a problem with printing selected pages. Actually, the problem
isn't with printing selected pages as it is more to do with having blank
pages print for those pages that have not been...
|
by: Patrick De Ridder |
last post by:
How can I turn what I want to print 90 degrees using the logic below?
Please tell me the code with which to make the modification.
Many thanks,
Patrick.
using System.ComponentModel;
using...
|
by: Tim |
last post by:
Hi,
I am creating my own method for printing. I am using PrintDocument and
cycling through the data and creating new pages as neccessary.
My question is, how can I know that total number of...
|
by: Rob T |
last post by:
I have a small VB program that has a printing module...very simple....and
works great. However, If I try to print to a generic printer, I get the
following error: "The data area passed to a...
|
by: Bill |
last post by:
Hi
I am trying to get my listbox items to print if they stream past the one
page mark. my code is working for one page of information (if the
e.hasmorepages) is not there.
But I am having...
|
by: islay |
last post by:
Hello,
I'm trying to print more than one page using the PrintDocument object.
I set "e.HasMorePages = True" after completeing the first page in the
"PrintDocument1_PrintPage" subroutine, and...
|
by: Richard MSL |
last post by:
I have an application that prints documents that it creates. It uses what I
believe is a standard .NET way of doing so, like this:
PrintDocument pd = new PrintDocument();
pd.PrintPage += new...
|
by: tghamm |
last post by:
Ok, so this is driving me mad. For some reason, regardless of the
value of ev.hasmorepages, the printoducment1_printpage gets called
twice for every page. So, I print 2 pages of data on one page,...
|
by: deepakfordotnet |
last post by:
Hi,
First of all let me confess that I could not get the solution to the same problem from an earlier post Printing :by Mr.Richard MSL (dated September 24th 2006) working.
(Replied by Mr.Walter...
|
by: it0ny |
last post by:
Hi guys,
thanks I am fairly new to this forum so I hope I chose the right place to post this question.
I try to make my program printout a deposit's report. I created a class to store the...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |