Taking a screen shot of a form

  • Thread starter Thread starter Kent Boogaart via .NET 247
  • Start date Start date
K

Kent Boogaart via .NET 247

Hi everyone,

This is my first post to this group . . .

Given an instance of System.Windows.Forms.Form, is it possiblefor me to take a "screen shot" of it as it would appear insidethe VS.NET designer? I want to do this without calling aconstructor or displaying the form anywhere on the screen. Iwould like to end up with a System.Drawing.Image instancecontaining the "screen shot" of the form.

Thanks for any help,
Kent
 
The GDI+ FAQ has an article on this subject.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*

The GDI+ FAQ: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://royo.is-a-geek.com/siteFeeder/GetFeed.aspx?FeedId=41

*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*RSS*





Hi everyone,

This is my first post to this group . . .

Given an instance of System.Windows.Forms.Form, is it possible for me to
take a "screen shot" of it as it would appear inside the VS.NET designer? I
want to do this without calling a constructor or displaying the form
anywhere on the screen. I would like to end up with a System.Drawing.Image
instance containing the "screen shot" of the form.

Thanks for any help,
Kent
 
Thanks Bob,

I read and tried out the relevant FAQ but have these issues with it:

1. I have to instantiate the Form object in order to show it, which leads me
to
2. I have to show it in order to grab the image.

It is not really a screen shot I want but a snap shot of what the form
*would* look like if it *were* to be displayed. I don't want the user to see
a form flash up on the screen whilst I take a grab of it. I'm making a
(possibly big) assumption that this is all possible because VS.NET somehow
manages to display a design view for a form without invoking a constructor.

Regards,
Kent
 
Back
Top