Never
Never

Reputation: 323

Creating graphic from a window at full size

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.

Upvotes: 0

Views: 116

Answers (1)

LarsTech
LarsTech

Reputation: 81620

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:
}

Upvotes: 1

Related Questions