Congratulations to all the winners of April 2013, they have won INR 3400 cash and INR 20147 worth prizes !
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 11713 |  Welcome, Guest!   Register  Login
 Home > Coding Horrors > C# > Capture and save active window including taskbar. ...
Rajkatie

Capture and save active window including taskbar.

 Coding Horror posted by: Rajkatie | Posted on: 3/3/2012 | Category: C# | Views: 1912 | Level: Silver | Status: [Member] | Points: 75 | Alert Moderator   



try
            {
                
                using (Bitmap imageBmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Graphics.FromHwnd(IntPtr.Zero)))
                {
                
                    using (Graphics graphics = Graphics.FromImage(imageBmp))
                    {
                        graphics.CompositingQuality = CompositingQuality.HighQuality;
                        graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                        graphics.SmoothingMode = SmoothingMode.HighQuality;

                
                        graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, imageBmp.Size, CopyPixelOperation.SourceCopy);
                        imageBmp.Save("d:\\temp.jpeg",ImageFormat.Jpeg);
                    }
                }
            }
            catch (Exception ex)
            {
                // log the exception

            }


Rajesh Patel
MCP,MCTS,MCPD,MS
Brainbench (Asp.Net 4.0 and CSS 3.0)
Found interesting? Add this to:


About Rajesh Patel

Experience:6 year(s)
Home page:http://www.dotnetfunda.com/profile/rajkatie.aspx
Member since:Tuesday, February 14, 2012
Level:Silver
Status: [Member]
Biography:More than 6 years of professional experience in web based application development using Microsoft technology stack like ASP.NET with C#, .Net Ajax,Sql Server 2008/2005, .Net Web Services (Asmx,Page Methods and WCF).

Ability choose the best technology, platform and technique, based on a given problem definition and drive the best implementation through all development phase.
>> Write Response - Respond to this post and get points

More Coding Horrors

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/19/2013 11:29:19 AM