Printing Window Forms with scrollable panel

I've a panel in the Form and the background of this panel is set to an image which is of A4 size, to be able to view the complete A4 size form...i've set Scrollable property to true.... this is the point where I'm right now...from this point...I need to capture the entire A4 size of the panel into an image....I've done some research and found a method to print the content of the desktop...but I'm not able to figure out how I can get the entire scrollable panel which is of A4 size. I cannot do any re-sizing...any other solutions will be appreciated....
pnadakuditiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WarpsehCommented:
Try this :)
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Bitmap b = new Bitmap(e.PageBounds.Width, e.PageBounds.Height);
            foreach (Control c in panel1.Controls)
            {
                c.DrawToBitmap(b, c.Bounds);
            }
            e.Graphics.DrawImage(b, 0, 0);
        }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.