Take the 2-minute tour ×

I have a window which I can resize. I want to print a full snapshot of this window, regardless of the size of the window. For example:

Window is normally 800 x 600 but can be as small as 300 x 300 but I still want to print at 800 x 600 pixels.

When I use Graphics mygraphics = this.CreateGraphics() I get a small image not at the desired size.

share|improve this question
What kind of drawing is being done on this window? Is it just controls? Do you have a custom drawing routine? It's generally bad practice to draw a control directly to a page. You just want to draw the content, not the buttons/etc. What type of content do you have? –  Trevor Elliott Jan 17 '12 at 21:10
add comment

1 Answer

up vote 1 down vote accepted

You probably need to hold the "graphic" in a background bitmap:

Bitmap myImage = new Bitmap(800, 600);

And to draw on it:

using (Graphics g = Graphics.FromImage(myImage)) {
  // do stuff:
share|improve this answer
add comment

Your Answer


