TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rafal
NA
3
0
How printing multipages from a listBox C#?
Dec 16 2009 6:31 AM
Hi
I can`t print more pages, only one page.
This is my code :/
private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float linesPerPage = 0;
float yPos = 0;
int i = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
SolidBrush myBrush = new SolidBrush(Color.Black);
Font printFont = this.listBox1.Font;
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
while (i < linesPerPage && i < listBox1.Items.Count)
{
yPos = topMargin + (i * printFont.GetHeight(e.Graphics));
line = listBox1.Items[i].ToString();
e.Graphics.DrawString(line, printFont, Brushes.Black,leftMargin, yPos, new StringFormat());
i++;
}
if (i <= listBox1.Items.Count)
e.HasMorePages = true;
else
{
e.HasMorePages = false;
i = 0;
}
}
what is wrong?
Pleas, help me :(
Reply
Answers (
0
)
Finding C# source code for MCQ
displaying the url from internet explorer in a text box