2 Replies - 431 Views - Last Post: 26 October 2012 - 04:40 AM Rate Topic: -----

#1 KasunL  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 11-April 11

Best way to get a pic of a Form

Posted 26 October 2012 - 03:11 AM

Hi!

What's a good way to take a snapshot of a specific form of my app? is there a class function or something to get a snap of only a single form or do i need to calculate the desktop coordinations of my form and get a snap of those coords?

Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: Best way to get a pic of a Form

#2 KasunL  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 11-April 11

Re: Best way to get a pic of a Form

Posted 26 October 2012 - 04:21 AM

ok sorry, i found a solution:


Rectangle bounds = this.Bounds;
            using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
            {
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
                }
                bitmap.Save("E://test.bmp", ImageFormat.Bmp);
            }



Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Best way to get a pic of a Form

Posted 26 October 2012 - 04:40 AM

All control have the "capability" to be displayed / captured as a bitmap.
See the following extension method I wrote.
Snippet: Control To Bitmap

This post has been edited by AdamSpeight2008: 26 October 2012 - 07:07 AM

Was This Post Helpful? 2
  • +
  • -

Page 1 of 1