Printing Window Forms with scrollable panel

Posted on 2008-02-04
Medium Priority
Last Modified: 2013-11-26
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....
Question by:pnadakuditi
1 Comment

Accepted Solution

Warpseh earned 1500 total points
ID: 20818150
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


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question